xsl-list
[Top] [All Lists]

RE: order problem

2003-06-27 01:30:22
Hi,

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.

The solution you had was pull-processing, when for this sort of transformation 
push-processing is the natural way to go. Try e.g.

  <xsl:template match="*">
    <xsl:element name="{name()}1">
      <xsl:apply-templates select="*"/>
    </xsl:element>
  </xsl:template>
  <xsl:template match="record1 | record2">
    <xsl:variable name="num" select="substring(name(), string-length(name()), 
1)"/>
    <xsl:element name="record{$num + 2}">
      <xsl:value-of select="concat(., $num)"/>
    </xsl:element>
  </xsl:template>

Cheers,

Jarno

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



<Prev in Thread] Current Thread [Next in Thread>