RE: [xsl] group-starting-with problem

Subject: RE: [xsl] group-starting-with problem
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 12 Dec 2005 20:18:29 -0000
> My input:
> 
> <xsl:variable name=element_definition_lines">
> 
>     <element>
>      <line>REQUIRED ST01</line>
>      <line>Code uniquely identifying a Transaction Set</line>
>      <line>REQUIRED</line>
>      <line>REQUIRED ST02</line>
>      <line>Identifying control number that must be unique within the
> transaction set</line>
>     </element>
> 
> </xsl:variable>

The type of this variable is document-node(elemnet(element)): that is, a
document node whose child is an element named "element".

The path expression $element_definition_lines/line selects the children of
this document node that are named "line", and there aren't any.
> 
> I've tried the following code:
> 
> <xsl:for-each-group select="$element_definition_lines/line"
> group-starting-with="REQUIRED " >
> 
> Please note the space in the group-starting-with attribute.  

The group-starting-with attribute is a match pattern. Your pattern is
matching elements named REQUIRED. To match elements whose string value is
"REQUIRED ", use group-starting-with="line[.='REQUIRED ']". To match
elements whose string value starts with "REQUIRED ", use
group-starting-with="line[starts-with(.,'REQUIRED)]"

Michael Kay
http://www.saxonica.com/

Current Thread