[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] group-starting-with problem


Subject: [xsl] group-starting-with problem
From: James Neff <jneff@xxxxxxxxxxxxxxxx>
Date: Mon, 12 Dec 2005 14:49:00 -0500

Greetings,

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>

I've tried the following code:

<xsl:for-each-group select="$element_definition_lines/line"
group-starting-with="REQUIRED " >
                   
    <xsl:element name="element" >
                       
        <xsl:for-each select="current-group()">
                       
            <xsl:copy-of select="." />
                   
         </xsl:for-each>
                       
      </xsl:element>

</xsl:for-each-group>

Please note the space in the group-starting-with attribute.  There will
always be a space in my input after the string 'REQUIRED' when I want a
new group seperator.  The third line has the string 'REQUIRED' also, but
does not have a trailing space and thus I do not want it considered as a
group seperator.

My desired output is:

    <element>
        <line>REQUIRED ST01</line>
        <line>Code uniquely identifying a Transaction Set</line>
        <line>REQUIRED</line>
    </element>   
    <element>
         <line>REQUIRED ST02</line>
         <line>Identifying control number that must be unique within the
transaction set</line>
    </element>


However it does not appear to be grouping.  All of the <line> elements
are part the group, instead of splitting them into two groups.

Can someone point me in the right direction please?

Thank you,

-- 

James Neff
Technology Specialist

Tethys Health Ventures
4 North Park Drive, Suite 203
Hunt Valley, MD  21030

office:  410.771.0692 x103
cell:    443.865.7874


Current Thread