This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
repeat and replace loop ( at the same time )
- From: progressdll linux <progressdll dot linux at mail dot be>
- To: xsl-list at lists dot mulberrytech dot com
- Date: Tue, 2 Apr 2002 16:40:35 +0200 (GMT+02:00)
- Subject: [xsl] repeat and replace loop ( at the same time )
- Reply-to: xsl-list at lists dot mulberrytech dot com
repeat and replace loop ( at the same time )
I have difficult time trying the following in XSLT.
I need to repeat an XML record and replace it at the same time with different data.
Let me show you an example:
<root>
<record>
<namedcell name="ordernumber"/>
<data>0</data>
<namedcell name="price"/>
<data>0</data>
</record>
</root>
this is my template record that i want to use to fill my output xml.
So i need to repeat the template record as many time as i want records
and replace the data at the same time.
I am able to repeat and replace but not in 1 go. The replace data comes
from a second xml that will replace according to the namedcell value.
<root>
<record>
<ordernumber>1</ordernumber>
<price>111</price>
</record>
<record>
<ordernumber>2</ordernumber>
<price>222</price>
</record>
</root>
So this should result in 2 record. I always read this xml in via the document function.
<xsl:variable name="file" select="document('replace_data.xml')"/>
and on match = "record" i apply this template.
<xsl:apply-templates select="$file/root"/>
This will loop x time that there are record.
But then i can't replace the data.
result should be
<root>
<record>
<namedcell name="ordernumber"/>
<data>1</data>
<namedcell name="price"/>
<data>111</data>
</record>
<record>
<namedcell name="ordernumber"/>
<data>2</data>
<namedcell name="price"/>
<data>222</data>
</record>
</root>
Thanks for any feedback. I am really stuck.
PG
-----------------------------------------------------
Mail.be, Free WebMail and Virtual Office
http://www.mail.be
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list