Re: [xslt] Re: simpler testcase



On Fri, 28 Mar 2003, Daisuke Maki wrote:

> two things:
>
>    (1) there was a typo in my code,
>    (2) *I* said that XML::LibXML (the perl module) is broken, not libxml2
>
> For (1), the xpath expression should have read /foo:foo/foo:bar. Which
> works on xsltproc:
>
> source XML:
>    <foo xmlns="urn:foo">
>       <bar>BAZ!</bar>
>    </foo>
>
> XSL file:
>    <xsl:output method="text" />
>    <xsl:template match="foo:foo">
>        <xsl:value-of select="foo:bar" />
>    <xsl:template>
>
> This prints "BAZ!" using xsltproc. With XML::LibXML and XML::LibXSLT, it
> doesn't even match with foo:foo.

Of course, because you haven't mapped the namespace prefix. To do that you
need XML::LibXML::XPathContext, from CPAN.

-- 
<!-- Matt -->
<:->get a SMart net</:->
Spam trap - do not mail: spam-sig@spamtrap.messagelabs.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]