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

Re: avoiding assignment statements

Subject: Re: avoiding assignment statements
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 8 Dec 2006 14:28:36 GMT
Re:  avoiding assignment statements
xslt works rather better if you have structured input rather than a fixed
set of flat variables. If you had a parameter show that took a list of
elements say <Replicates/><Metadata/>  then you could just do
<xsl:for-each select="$show">
 <xsl:if test="position()!=1">, </xsl:if>
 <xsl:apply-templates select="."/>
</xsl:for-each>

where templates macching Replicates woul ddo whatever your pseudo code
Output("Reps") does.


or in xslt2 you could just have again a single parameter which takes a
sequence of strings rather than elements, and again for-each over that.

As it is, with scalar params, it's a bit easier to handle in xslt2, as
you can easily turn it into the above

<xsl:variable name="show" as="element()*">
<xsl:if test="showReplicates=1"><Replicates/></xsl:if>
...
</xsl:if>

in xslt1 you could do the same with the node-set extension that most
systems offer.



David

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.