[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: multiple template value input

Subject: Re: multiple template value input
From: David Carlisle <davidc@xxxxxxxxx>
Date: Thu, 18 Sep 2003 17:04:38 +0100
xml value input

> 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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.