xsl-list
[Top] [All Lists]

Re: [xsl] Passing a list of arguments

2007-11-09 06:21:33
On 11/9/07, Mathieu Malaterre <mathieu(_dot_)malaterre(_at_)gmail(_dot_)com> 
wrote:
test.xml:
<?xml version="1.0" encoding="UTF-8"?>
<article>
</article>

test.xsl:
<?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">
   <section>
     <section>C.8.7.1.1.2</section>
     <section>C.8.14.1.1</section>
     <!-- ... -->
   </section>
 </xsl:variable>
 <xsl:template match="article">
   <xsl:param name="extract-section"/>
   <xsl:message>
     <xsl:value-of select="$extract-section"/>
   </xsl:message>
 </xsl:template>
 <xsl:template match="/">
   <xsl:for-each select="$sections-list">
     <xsl:apply-templates select="article">
       <xsl:with-param name="extract-section" select="$section"/>
     </xsl:apply-templates>
   </xsl:for-each>
 </xsl:template>
</xsl:stylesheet>

You seem to be missing something.

I think, the root template should be:

 <xsl:template match="/">
   <xsl:for-each select="$sections-list/section/section">
     <xsl:apply-templates select="article">
       <xsl:with-param name="extract-section" select="."/>
     </xsl:apply-templates>
   </xsl:for-each>
 </xsl:template>

It's not clear to me what exactly is your requirement. But you seem to
be writing a wrong XPath expression.

-- 
Regards,
Mukul Gandhi

--~------------------------------------------------------------------
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>