← Prev in month
← Prev in thread
XPath on sequences of nodes
Hi! I am observing a strange phenomenon in an xslt-based project, using the Saxon 8 processor. It pertains to a sequence of nodes created within a perform-sort instruction. In the simple xslt sheet following this message, I create a sequence of nodes, store it in a variable, and I print its content through 2 very similar instructions, but I get one node sequence for the first instruction, and another (inverted) one for the second instruction. For the life of me, I don't know what's happening. How can a variable store 2 different results? I'd really appreciate it if someone could give me a hint. Thank you very much. Fabrizio Gotti RALI - http://rali.iro.umontreal.ca/ ============================ <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xsl:output method="xml" indent="yes" encoding="UTF-8" /> <xsl:template match="/"> <xsl:variable name="selectedSents" as="node()*"> <xsl:perform-sort> <xsl:sort order="descending"/> <sent> <c>one</c> </sent> <sent> <c>two</c> </sent> </xsl:perform-sort> </xsl:variable> <debug> <!-- Here, the very same variable selectedSents will yield 2 different representations --> <bad> <xsl:copy-of select="$selectedSents/c"/> <!-- one sequence --> </bad> <good> <xsl:copy-of select="$selectedSents" /><!-- another sequence, inverted --> </good> </debug> </xsl:template> </xsl:stylesheet>
← Prev in month
← Prev in thread