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

Re: Creating and passing XML String to xsl:call-templa

Subject: Re: Creating and passing XML String to xsl:call-template.
From: Oleg Tkachenko <olegt@xxxxxxxxxxxxx>
Date: Sun, 27 Jan 2002 11:46:11 +0200
create xmlstr string
Avula, Raj wrote:

	I want to create a XML String in a template and pass it as a
paramter to xsl:call-template.
There I want to parse that XML String and get the values. Reasons why I want
to do this
is to reduce number of parameters passed to xsl:call-template and other is
to reduce the size of the calling template.

eg:

First template:
	<xsl:template name="FirstTemplate">
		<xsl:variable name="XMLString">

First of all it's not really string but tree (rtf aka result tree fragment, see http://www.w3.org/TR/xslt.html#section-Result-Tree-Fragments).


> <customer>

		<xsl:if test="cust_name1">
			<name>
			<xsl:value-of select="cust_name1" />
			</name>
		<xsl:if>
		<xsl:if test="cust_name2">
			<name>
			<xsl:value-of select="cust_name2" />
			</name>
		<xsl:if>

You forgot </customer>



</xsl:variable>

		<xsl:call-template name="SecondTemplate">
			<xsl:with-param name="xmlstr" select="$XMLString" />
		</xsl:call-template>
	</xsl:template>


<xsl:template name="SecondTemplate> <xsl:param name="xmlstr" />

here something like for each customer/name
-- get the name and print by formattig.

for-each needs node-set, but you have rtf, so the only way is to convert it to node-set by xxx:node-set(rtf) ext function, where xxx - is your processor extension (see your xslt processor's doc).
<xsl:for-each select="xxx:node-set($xmlstr)/customer/name">
....



</xsl:template>

	Can I do something like this. If not Can any body suggest an
alternative of doing this.

I think it's the best way.



-- Oleg Tkachenko Multiconn International, Israel


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.