Re: Cannot use a parameter value in the group-startin
Hi. I'm writing a 2.0 stylesheet and my processor is Saxon HE 126.96.36.199. Also, I'm just starting out with XSLT.
There are two problems there, one is that patterns use a restricted syntax compared to xpath, but more importantly parameters and variables in xpath hold _values_ (as they would in c or fortran) not fragments of syntax 9as they would in a shell scripting language)
so when you go <xsl:with-param name="starting-element" select = "h1" />
the parameter does not hold the fragment of a pattern "h1" it holds the result of ebaluating teh expression h1 at that point, which is a possibly empty sequence of h1 nodes.
the this works
<xsl:for-each select = "$starting-element">
but it is not (at that point) selecting h1 elements it is simply iterating over the list of elements that has already been selected and stored in the $starting-element variable.
but this could not work even if it were not a syntax error
<xsl:for-each-group select = "*" group-starting-with = "$starting-element">
the grouping attributes need to take patterns or expressions used to filter the nodes selected, not take a sequence of nodes.
so do not pass in a sequence of nodes, pass in a string:
<xsl:with-param name="starting-element" select = "'h1'" />
(note the extra quotes(
then you can use that string in a pattern
PURCHASE STYLUS STUDIO ONLINE TODAY!
Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!
Download The World's Best XML IDE!
Accelerate XML development with our award-winning XML IDE - Download a free trial today!
Subscribe in XML format