xsl-list
[Top] [All Lists]

Re: multiple template value input

2003-09-18 14:41:26
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(_at_)nag(_dot_)co(_dot_)uk>:



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(.,'&quot;\&quot;'), '&quot;')"/>
 </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(.,'&quot;\&quot;'), '&quot;')"/>
 </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(.,'&quot;\&quot;'), '&quot;')"/>
 </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(_dot_)schrenk(_at_)gmx(_dot_)net
mobile: +43 69911602281


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>