Subject: Re: [xsl] multiple template value input From: David Carlisle <davidc@xxxxxxxxx> Date: Thu, 18 Sep 2003 17:04:38 +0100 |
> all of these work perfectly, except the variable "frank" that is put in as > the outcomes of all the for-each loops in the first template put together... which is what I would expect, given your code, but if that's what you wanted then it's not clear what you do want, so hard to suggest what to change. <xsl:template match="INSTANCE" name="joseph"> <xsl:for-each select="key('tracker', 'Referenced Document')"> <xsl:copy-of select="substring-before(substring-after(.,'"\"'), '"')"/> </xsl:for-each> </xsl:template> that for-each will make some collection of strings but you can't have adjacent text nodes in xpath so what is returned is a single text node with the concatenation. this is as would eb expected in xml, if you need to have a series of distinct strings you need some xml element structure somewhere. You could do <xsl:template match="INSTANCE" name="joseph"> <xsl:for-each select="key('tracker', 'Referenced Document')"> <abc> <xsl:value-of select="substring-before(substring-after(.,'"\"'), '"')"/> </xsl:for-each> </abc> </xsl:template> then <xsl:variable name="frank"> <xsl:call-template name="joseph"> </xsl:call-template> </xsl:variable> would be a result tree fragment consisting of a root node with a set of abc element children each containing a text node with your substrings then you could use xx:node-set($frank)/abc to access each of those strings, but depending what you are trying to do you probably don't need an node-set extension, why make the variable first, why not just do <xsl:for-each select="key('tracker', 'Referenced Document')"> <xsl:call-template your replacement text with input string this: <xsl:copy-of select="substring-before(substring-after(.,'"\"'), '"')"/> </xsl:for-each> </xsl:call-template> </xsl:template> and so just handle one string at a time? David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star Internet. 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 ________________________________________________________________________ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] multiple template value i, clemens schrenk | Thread | Re: [xsl] multiple template value i, clemens schrenk |
[xsl] conditional looping in for lo, navjeet chabbewal | Date | [xsl] conditional looping in a for , navjeet chabbewal |
Month |