loop in loop
Here should go questions about transforming XML with XSLT and FOP.
-
- Posts: 1
- Joined: Thu Jan 18, 2007 9:33 pm
loop in loop
hi,
i'm beginer in xsl transformation. i editing xsl with altova style vision
I have one problem with working with two nodes.
<root>
<Items>
<ItemID>1<ItemID>
<ItemDes>A<ItemDes>
</Items>
<Items>
<ItemID>2<ItemID>
<ItemDes>B<ItemDes>
</Items>
<DetailDes>
<DetItemID>1</DetItemID>
<Detail>HI<Detail>
</DetailDes>
<DetailDes>
<DetItemID>2</DetItemID>
<Detail>tnx<Detail>
</DetailDes>
</root>
I would like to make a teble(loop items) and in this table i make another loop (loop DetailDes). in table (items) i need to displey only items ItemID = DetItemID.
example table:
----------------------------------
Item ID | Description |
---------------------------------
1 | A|
details: HI
--------------------------------
2 | B|
details: tnx
--------------------------------
tnx for any help[/code]
i'm beginer in xsl transformation. i editing xsl with altova style vision
I have one problem with working with two nodes.
<root>
<Items>
<ItemID>1<ItemID>
<ItemDes>A<ItemDes>
</Items>
<Items>
<ItemID>2<ItemID>
<ItemDes>B<ItemDes>
</Items>
<DetailDes>
<DetItemID>1</DetItemID>
<Detail>HI<Detail>
</DetailDes>
<DetailDes>
<DetItemID>2</DetItemID>
<Detail>tnx<Detail>
</DetailDes>
</root>
I would like to make a teble(loop items) and in this table i make another loop (loop DetailDes). in table (items) i need to displey only items ItemID = DetItemID.
example table:
----------------------------------
Item ID | Description |
---------------------------------
1 | A|
details: HI
--------------------------------
2 | B|
details: tnx
--------------------------------
tnx for any help[/code]
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Please note that this forum is a support channel for oXygen XML editor which is a competitor for the product you are using. We cannot provide you advise on how to use that product, we advise you to direct your further questions to the support channels of that product.
Note that your sample input is not XML, it is not wellformed. The corrected input looks like
A sample stylesheet that generates a HTML table similar with the one from your description from the sample XML is below
Regards,
George
Note that your sample input is not XML, it is not wellformed. The corrected input looks like
Code: Select all
<root>
<Items>
<ItemID>1</ItemID>
<ItemDes>A</ItemDes>
</Items>
<Items>
<ItemID>2</ItemID>
<ItemDes>B</ItemDes>
</Items>
<DetailDes>
<DetItemID>1</DetItemID>
<Detail>HI</Detail>
</DetailDes>
<DetailDes>
<DetItemID>2</DetItemID>
<Detail>tnx</Detail>
</DetailDes>
</root>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="root">
<html>
<head><titel>Sample</titel></head>
<body>
<table border="1">
<tr><th>ItemID</th><th>Description</th></tr>
<xsl:apply-templates select="Items"/>
</table>
</body>
</html>
</xsl:template>
<xsl:template match="Items">
<tr>
<td><xsl:value-of select="ItemID"/></td>
<td><xsl:value-of select="ItemDes"/></td>
</tr>
<tr>
<td colspan="2">
<xsl:text>details: </xsl:text>
<xsl:value-of select="../DetailDes[DetItemID=current()/ItemID]/Detail"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
George
George Cristian Bina
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service