[xsl] order problem

Subject: [xsl] order problem
From: "Shadab" <mohammad.shadab@xxxxxxxxxxx>
Date: Fri, 27 Jun 2003 13:32:41 +0530
> Hi,
>
> I have this element hierarchy
>
> Source::
> root
>     body
>         record1(*)
>         record2(*)
>
> Destination::
> root1
>     body1
>         record3(*)
>         record4(*)
>
> Here occurence of record1 and record2 can occur any number of times.This
> will be my source xml on which the transform is to be applied.Following is
> the xsl
>
> <xsl:template match="/" name="root">
> <xsl:element name="root1">
>  <xsl:element name="body1">
>   <xsl:for-each select="/root/body/record1">
>    <xsl:element name="record3"><xsl:value-of
> select="concat(.,'1')"/></xsl:element>
>   </xsl:for-each>
>   <xsl:for-each select="/root/body/record2">
>    <xsl:element name="record4"><xsl:value-of
> select="concat(.,'2')"/></xsl:element>
>   </xsl:for-each>
>  </xsl:element>
> </xsl:element>
> </xsl:template>
>
> Only problem would be that i need the order of records to be same in
output
> as in input and input of records can be in random order,viz
> <record1><record1><record2><record1><record2><record1>.But with the two
> for-loops this will break the sequence.
>
> How can this be done.
>
> Any help on this would be deeply appreciated.
>
> Thanks,
> Shadab
>


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread