|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] repeat and replace loop ( at the same time )
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






