p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

xslt thread: Duplicate elements


Message #1 by "Alex Grivnin" <alexg@o...> on Thu, 27 Jun 2002 16:30:34
Dear Michael,

Thanks for the reply. I'm sorry for not making myself clear.

The point was automatically duplicate the 'page' element from the source 
document and generate identical elements in the target document that 
differ only in their attribute values. 

I was trying to do this with <xsl:for-each>, but it allows iteration only 
on the source document elements. It seems that the only way is to 
recursively call an <xsl:template>, but I was not able to find out how and 
what should be send to the template?s parameters.

Thanks for your help,
Alex

 
> Without knowing what algorithm you want to use to generate the elements,
it's a bit difficult. But you could do:

<xsl:template match=3D"page">
<page number=3D"{@number}"/>
<page number=3D"{@number+1}"/>
<page number=3D"{@number+2}"/>
<page number=3D"{@number+3}"/>
</xsl:template>

Michael Kay
Software AG
home: Michael.H.Kay@n...
work: Michael.Kay@s...=20

  Return to Index