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

Cannot use a parameter value in the group-starting-wit

Subject: Cannot use a parameter value in the group-starting-with attribute?
From: Peter Desjardins <peter.desjardins.us@xxxxxxxxx>
Date: Fri, 14 May 2010 15:49:17 -0400
 Cannot use a parameter value in the group-starting-wit
Hi. I'm writing a 2.0 stylesheet and my processor is Saxon HE 9.2.1.1.
Also, I'm just starting out with XSLT.

I am trying to create a template with parameters that will use the
for-each-group element. I find that I cannot use a parameter value in
the group-starting-with attribute.

For example, I call my parametrized template from the following template.

<xsl:template match = "body" >
    <xsl:call-template name="wrapping-template">
         <xsl:with-param name="starting-element" select = "h1" />
    </xsl:call-template>
</xsl:template>

If I include the parameter value in a select attribute, the stylesheet
compiles and I see the expected output. The for-each element iterates
over a sequence of h1 elements.

<xsl:template name = "wrapping-template" >
    <xsl:param name = "starting-element" />
    <xsl:for-each select = "$starting-element">
        <xsl:value-of select = "name()" />
    </xsl:for-each>
</xsl:template>

If I include the parameter value in the group-starting-with attribute,
the stylesheet fails to compile.  The error message is "XTSE0340: XSLT
Pattern syntax error at char 0 on line 28 in {$starting-element}:
Unexpected token in pattern, found "$"." Line 28 is the one shown
below with the <xsl:for-each-group> element.

<xsl:template name = "wrapping-template" >
    <xsl:param name = "starting-element" />
    <xsl:for-each-group select = "*" group-starting-with = "$starting-element" >
        <xsl:apply-templates select="." mode="group"/>
    </xsl:for-each-group>
</xsl:template>

Are parameter values not allowed in the group-starting-with attribute?
Is there some syntax I can use to expand the parameter before the
processor tries to interpret the group-starting-with attribute?

Thanks for your help.

Peter

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.