Subject: Re: [xsl] multiple template value input From: clemens schrenk <clemens.schrenk@xxxxxxx> Date: Thu, 18 Sep 2003 23:41:26 +0200 |
well, yes - i want to have a series of distinct strings, and i really wanna go for the last option you proposed. but as a matter of fact, i don't know how to set the xsl:copy-of element as an input string of the called templated since it is an essential part of the template where itself and the call-template element is used. sorry to cause you that much trouble... Am 18.09.2003 18:04 Uhr schrieb "David Carlisle" unter <davidc@xxxxxxxxx>: > > >> 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 > ____________________________________________________________________________ chance favors the prepared mind: clemens Schrenk esterhazygasse 18a/21 1060 wien clemens.schrenk@xxxxxxx mobile: +43 69911602281 XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] multiple template value i, David Carlisle | Thread | Re: [xsl] multiple template value i, clemens schrenk |
Re: [xsl] Callstack overflow error , Dipesh Khakhkhar | Date | RE: [xsl] Critique/comments sought:, Robert Koberg |
Month |