Subject: Re: [xsl] Can I predict the build order of nodes? From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx> Date: Sun, 14 Feb 2010 14:09:55 -0500 |
I noticed an interesting build order/selection issue between Saxon and Microsoft XSL transforms ... in my style sheet I have:
<xsl:param name="stylemasterfile"> <xsl:value-of select="/winelist/stylemasterfile"/> </xsl:param>
<xsl:param name="stylemasterset" select="document($stylemasterfile)/styles | /winelist/styles"/>
<xsl:variable name="stylemaster" select="$stylemasterset[last()]"/>
The XML may have:
1) a file pointer (in /winelist/stylemasterfile) which contains <styles> 2) an embedded <styles> (at /winelist/styles) 3) both
If it contains both, the rule should be to select the embedded one.
But selecting $stylemasterset[last()] and testing I noted that they are in opposite order on the two XSLT transformers when both exist.
Without saying which is which ... what is the right answer?
What do you think is the proper result of this:
document($stylemasterfile)/styles | /winelist/styles
Internal styles from /winelist/styles External styles from document($stylemaster)/styles
or
External styles from document($stylemaster)/styles Internal styles from /winelist/styles
Or does the spec make no determination of order?
<xsl:variable select="document($stylemasterfile)/ styles[not($in/winelist/styles)][last()] | $in/winelist/styles[last()]" name="stylemaster"/>
... which is to say "use the last of the external document only if there are no internal styles, in union with the last of the internal styles
<xsl:variable select="document($stylemasterfile)/ styles[not($in/winelist/styles)] | $in/winelist/styles" name="stylemaster"/>
-- XSLT/XQuery/XPath training after http://XMLPrague.cz 2010-03-15/19 XSLT/XQuery/XPath training: San Carlos, California 2010-04-26/30 Vote for your XML training: http://www.CraneSoftwrights.com/s/i/ Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/ Training tools: Comprehensive interactive XSLT/XPath 1.0/2.0 video Video lesson: http://www.youtube.com/watch?v=PrNjJCh7Ppg&fmt=18 Video overview: http://www.youtube.com/watch?v=VTiodiij6gE&fmt=18 G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx Male Cancer Awareness Nov'07 http://www.CraneSoftwrights.com/s/bc Legal business disclaimers: http://www.CraneSoftwrights.com/legal
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] Can I predict the build order, Kevin Brown | Thread | RE: [xsl] Can I predict the build o, Michael Kay |
[xsl] Can I predict the build order, Kevin Brown | Date | RE: [xsl] Can I predict the build o, Michael Kay |
Month |