Subject: Re: [xsl] Using for-each on user arguments [was: Re: Passing a list of arguments] From: "Mathieu Malaterre" <mathieu.malaterre@xxxxxxxxx> Date: Fri, 9 Nov 2007 15:16:32 +0100 |
On Nov 9, 2007 3:06 PM, Andrew Welch <andrew.j.welch@xxxxxxxxx> wrote: > > On 09/11/2007, Mathieu Malaterre <mathieu.malaterre@xxxxxxxxx> wrote: > > Ok > > > > Maybe with a more explicit title I'll get some help. Basically I am > > trying to avoid writting an infinite <xsl:if test="arg1 or arg2 or > > arg3 ... ">. So as a procedurial guy I thought of doing a list of user > > defined values to iterate over. This lead me to (*), but of course > > this cannot be working since I got mixup in between my user input arg > > list, and the real XML document I am trying to parse. > > > > Thanks for help > > -Mathieu > > > > (*) > > <?xml version="1.0" encoding="UTF-8"?> > > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"> > > <xsl:output method="xml" indent="yes" encoding="UTF-8"/> > > <xsl:variable name="sections-list"> > > <args> > > <arg>C.8.7.1.1.2</arg> > > <arg>C.8.14.1.1</arg> > > </args> > > </xsl:variable> > > <xsl:template match="article"> > > <xsl:param name="extract-section"/> > > <el> > > <xsl:value-of select="$extract-section"/> > > </el> > > </xsl:template> > > <xsl:template match="/"> > > <e> > > <xsl:for-each select="$sections-list/args/arg"> > > <xsl:apply-templates select="article"> > > <xsl:with-param name="extract-section" select="."/> > > </xsl:apply-templates> > > </xsl:for-each> > > </e> > > </xsl:template> > > </xsl:stylesheet> > > I think you are asking for: > > <xsl:apply-templates select="article/*[name() = $sections-list/args/arg]"/> Almost.. I need to apply-templates 'article' for each arg of args... Those 'arg' are param of the template 'article'. Thanks, -- Mathieu
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Using for-each on user ar, Andrew Welch | Thread | Re: [xsl] Using for-each on user ar, Florent Georges |
Re: [xsl] Using for-each on user ar, Andrew Welch | Date | Re: [xsl] Using for-each on user ar, Florent Georges |
Month |