[SlugBug] more xslt questions. ignore if offended!
Mike Dewar
m.dewar at shef.ac.uk
Mon Jun 27 21:06:30 BST 2005
Brilliant, thanks alot for that. Just tried using Firefox to do the
conversion and it did fine, confirming what you said. It's weird: I
never even thought that the problem would be in the software I was using...
Cheers,
Mike Dewar
Chris J wrote:
>>OK. Have edited the xsl as you suggested. Thanks for the help.
>>
>>I'm using Perl and the XML::XSLT library to do the transformation.
>>
>>It's still spitting out the contents of the last <page> element rather
>>than the page element with the attribute title="home". Am I selecting
>>it correctly with the lines:
>>
>><xsl:apply-templates select="page[@title='Home']"/>
>>
>>
>>
>
>...Yes that's all okay. I think the problem lies with XML::XSLT. I've just
>installed it here and seeing the results you describe; taking a peek at
>their man page[1] shows that is doesn't fully support XPath:
>
> xsl:apply-templates limited
> Attribute 'select' is supported to the same
> extent as xsl:value-of supports path selections.
>
> Not supported yet: - attribute 'mode' - xsl:sort
> and xsl:with-param in content
>
> .
> .
> .
>
> xsl:value-of limited
> Inserts attribute or element values. Limited support:
> <xsl:value-of select=``.''/>
> <xsl:value-of select=``/root-elem''/>
> <xsl:value-of select=``elem''/>
> <xsl:value-of select=``//elem''/>
> <xsl:value-of select=``elem[n]''/>
> <xsl:value-of select=``//elem[n]''/>
> <xsl:value-of select=``@attr''/>
> <xsl:value-of select=``text()''/>
> <xsl:value-of select=``processing-instruction()''/>
> <xsl:value-of select=``comment()''/>
>
> and combinations of these.
>
>Essentially, it doesn't support elem[test expression]. The elem[n] listed
>above is to match a partiular element by index (e.g., //elem[1] will match
>the first 'elem' element it comes across). It seems there's a lot of stuff
>listed that isn't fully supported...
>
>Your best bet is to install a Perl hook into a full XSLT parser. There's a
>XML::Sablotron that I can see (I've not used it yet); Sablotron itself is
>straightforward to install (requires expat).
>
>There's also a perl wrapper for the Apache project's Xalan processor (I've
>not used Xalan, so can't comment on speed/size/complexity to install etc).
>
>Chris...
>[1] http://xmlxslt.sourceforge.net/manpage-XML-XSLT.html
>
>
>
More information about the SlugBug
mailing list