[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Inconsistent values from <xsl:variable/>
The use of an <xsl:if/> seem to result in different values being assigned: <xsl:variable name="RTF_GOOD"> <xsl:value-of select="//out-form:Subform[@idType = 'RuleContent']"/> </xsl:variable> <xsl:variable name="RTF_BAD"> <xsl:if test="2 > 1"> <xsl:value-of select="//out-form:Subform[@idType = 'RuleContent']"/> </xsl:if> </xsl:variable> Both have the same select="" expression; it's only the presence of the <xsl:if/> that changes things. $RTF_GOOD appears to contain the RTF that I expect; $RTF_BAD appears to be a string containing the flattened text() from within the RTF I expect. Any ideas why they differ ? Is this a bug in Xalan ? A bug in my understanding of XSL is far more likely :> --- Details --- The above is a trivial example; I know about <xsl:variable select="..."/>, but I need to do some conditional logic to determine exactly which nodeset to place into my variable.) (It may also be worth pointing out that I'm repeatedly using XPath on node-sets, along the lines of: <xsl:variable "foo" select="//elem1"/> <xsl:variable "bar" select="$foo//elem2"/> <xsl:variable "quux" select="$bar/[@attr = 'thing']"/> in case that explains anything ...) I'm examining the contents using this: <xsl:message>GOOD <xsl:call-template name="dumpContext"> <xsl:with-param name="myNodeSet" select="xalan:nodeset($RTF_GOOD)"/> </xsl:call-template> </xsl:message> <xsl:message>BAD <xsl:call-template name="dumpContext"> <xsl:with-param name="myNodeSet" select="xalan:nodeset($RTF_BAD)"/> </xsl:call-template> </xsl:message> <xsl:template name="dumpContext"> <xsl:param name="myNodeSet"/> <xsl:for-each select="$myNodeSet"> <xsl:value-of select="local-name()"/> <xsl:text>[</xsl:text> <xsl:for-each select="ancestor-or-self::*"> <xsl:text>/</xsl:text><xsl:value-of select="local-name()"/> </xsl:for-each> <xsl:text>]</xsl:text> <xsl:text>"</xsl:text> <xsl:value-of select="text()"/> <xsl:text>"</xsl:text> </xsl:for-each> </xsl:template> And seeing output like this: Validation ERROR: GOOD Subform[/QueryResult/FormSet/Form/Thing/Subform]""] Validation ERROR: BAD []"aaaaacoy3y0co110yy2005-01-012005-01-012005-01-03"] Many (many !) thanks, - Adam
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|