Consider this XSLT:
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" versi
+on="1.0">
<xsl:output method="xml" indent="yes" encoding="utf-8"/>
<xsl:param name='test'>testdata</xsl:param>
<xsl:template match="/">
<TAG>
<SOME_DATA>
</SOME_DATA>
</TAG>
</xsl:template>
</xsl:stylesheet>
Also, consider this perl snippet:
#perl;
# INIT ----
use warnings;
use strict;
use Win32::OLE qw(in with);
my $obj_xslt = Win32::OLE->new('MSXML2.DOMDocument.4.0') or die "new()
+ failed creating DOM";
$obj_xslt->{async} = "False";
$obj_xslt->load('<the_xslt_as_mentioned_above>');
# Get parameters from xslt
my $xpath = "//xsl:param[\@name='test']";
my $q = $obj_xslt->selectSingleNode($xpath);
print $q->item(0)->nodeValue, "\n";
My question: Why is this code not able to extract the value of the <xsl:param name='test'> variable? I tried about anything, no result however.
Can anyone help me retrieving the 'testdata' - data from the xslt?
I have to mention that this construct works fine with a 'plain xml' file. Since this xslt is also xml I reckon this should work also. Perhaps namespacing problem? I dunno. Please help!
Regards,
John
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.