[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: PART 3 -THE REVERSE DIRECTION -- Yet still moving
<!-- Minor question: Is there a better way to do this than using 'local' variables?--> <xsl:variable name="IND_NAME"> <xsl:value-of select="name()"/> </xsl:variable> If you _did_ need a variable then you should not define it like that: as it makes a result tree fragment which you don't need, you would just do <!-- Minor question: Is there a better way to do this than using 'local' variables?--> <xsl:variable name="IND_NAME" select="name()"/> But you should almost never test on name() that is just re-implementing (inefficiently, and in a way that is not namespace-safe) template matching. <xsl:variable name="CURRENT_NODE"> <xsl:value-of select="node()"/> </xsl:variable> That confusingly does not define CURRENT_NODE to be the current node (to do that you would do <xsl:variable name="CURRENT_NODE" select="."/> It defines it to be a result tree fragment representing _copies_ of _children_ of the current node. so don't do this <xsl:when test="$IND_NAME='NAME_MIDDLE'"> <abc:field name="THE_ALIAS" number="2"> you could do <xsl:when test="self::NAME_MIDDLE"> <abc:field name="THE_ALIAS" number="2"> But that, as I say is just a poir man's version of template matching so get rid of teh whole xsl:choose and just have <xsl:template match="NAME_MIDDLE"> .... <xsl:when test="$IND_NAME='NAME_PREFIX'"> So the current node here is NAME_PREFIX <xsl:apply-templates select="ALIAS" /> so the above line applies templates to all the ALIAS element children of the NAME_PREFIX element, but there are none. You presumably want to apply templates to ../ALIAS not ALIAS as ALIAS is your brother not your child. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
|
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
|