xsl-list
[Top] [All Lists]

Re: [xsl] avoiding assignment statements

2006-12-08 07:57:13
On 12/8/06, David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> wrote:

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>

Huston, there is a problem...

I tried it in the main XSLT and it wasn't working so I thought I would
put it into a very simply XSLT file so that it was the only thing that
happens and I simply cannot get it to work.  What am I missing?  Here
is the simple XSLT:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
 <xsl:output method="text" version="1.0" encoding="UTF-8" indent="yes"/>

 <xsl:param 
name="show"><showReplicates/><showMetadata/><showElectronicSignature/></xsl:param>

 <xsl:template match="/">
   <xsl:for-each select="$show">
    <xsl:if test="position()!=1">, </xsl:if>
    <xsl:apply-templates select="."/>
   </xsl:for-each>
 </xsl:template>

 <xsl:template match="showReplicates">
 Reps
 </xsl:template>

 <xsl:template match="showMetadata">
 Meta-Data
 </xsl:template>

 <xsl:template match="showElectronicSignature">
 Signature
 </xsl:template>

</xsl:stylesheet>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

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