|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] saving a no-set reference in a varaible
Hi - I have a situation where sometimes I need to get a piece of information from the XML that the XSL is currently parsing, and sometimes I need to get it from another document. I currently decide where to get it from using an xsl:choose each time I need data, however, it would be much more efficient if I could save the correct node-set into a variable. to give you a better idea, currently I do: <xsl:choose> <!-- check to see if we're in the same tree --> <xsl:when test="/family-tree/@id = $persontree"> <b><xsl:value-of select="id($personid)/name/@first"/></b> </xsl:when> <xsl:otherwise> <b><xsl:value-of select="document($persontree,/)/family-tree/person[@id=$personid]/name/@first"/></b> <xsl:otherwise> </xsl:choose> I would rather it be something like <xsl:variable name="thisNode"> <xsl:choose> <!-- check to see if we're in the same tree --> <xsl:when test="/family-tree/@id = $persontree"> <xsl:value-of select="id($personid)/name/@first"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="document($persontree,/)/family-tree/person[@id=$personid]/name/@first"/> <xsl:otherwise> </xsl:choose> </xsl:variable> <b><xsl:value-of select="$thisNode/name/@first"/></b> is this possible? it would greatly help - currently every time I need some info, I have to determine where to get it from. too much code. I have tried the code above for creating the variable, but I can't get it to work. what am I doing wrong? -Eric perceive designs <www.perceive.net> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|

Cart








