how to compare xml elemets in xslt
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 3
- Joined: Thu Feb 07, 2008 2:33 pm
how to compare xml elemets in xslt
hi all,
here is xml file.....
<root>
<Xmltype>
<owner NAME="Legal Entity 1"></owner>
<LegalEntity NAME="Legal Entity 1"></LegalEntity>
<lob NAME="Line Of Business 1"></lob>
<Formula>A</Formula>
<Formula>B</Formula>
</Xmltype>
<Xmltype>
<owner NAME="Legal Entity 1"></owner>
<LegalEntity NAME="Legal Entity 1"></LegalEntity>
<lob NAME="Line Of Business 1"></lob>
<Formula>c</Formula>
<Formula>D</Formula>
<Formula>B</Formula>
</Xmltype>
<Xmltype>
<owner NAME="Legal Entity 1"></owner>
<LegalEntity NAME="Legal Entity 1"></LegalEntity>
<lob NAME="Line Of Business 2"></lob>
<Formula>A</Formula>
</Xmltype>
<Xmltype>
<owner NAME="Legal Entity 1"></owner>
<LegalEntity NAME="Legal Entity 1"></LegalEntity>
<lob NAME="Line Of Business 2"></lob>
<Formula >B</Formula>
</Xmltype>
<Xmltype>
<owner NAME="Legal Entity 1"></owner>
<LegalEntity NAME="Legal Entity 1"></LegalEntity>
<lob NAME="Line Of Business 1"></lob>
<Formula>F</Formula>
</Xmltype>
</root>
I need XSLT for this.........
output should obtain like in HTML by using XSLT:
LegalEntityOwner:Legal Entity 1
LegalEntityName:LegalEntity
LobName:Line Of Business 1
Formula:A
Formula:B
Formula:C
Formula:D
Formula:B
Formula:F
LegalEntityOwner:Legal Entity 1
LegalEntityName:LegalEntity
LobName:Line Of Business 2
Formula:A
Formula:B
pleas can any one help!!!!
here is xml file.....
<root>
<Xmltype>
<owner NAME="Legal Entity 1"></owner>
<LegalEntity NAME="Legal Entity 1"></LegalEntity>
<lob NAME="Line Of Business 1"></lob>
<Formula>A</Formula>
<Formula>B</Formula>
</Xmltype>
<Xmltype>
<owner NAME="Legal Entity 1"></owner>
<LegalEntity NAME="Legal Entity 1"></LegalEntity>
<lob NAME="Line Of Business 1"></lob>
<Formula>c</Formula>
<Formula>D</Formula>
<Formula>B</Formula>
</Xmltype>
<Xmltype>
<owner NAME="Legal Entity 1"></owner>
<LegalEntity NAME="Legal Entity 1"></LegalEntity>
<lob NAME="Line Of Business 2"></lob>
<Formula>A</Formula>
</Xmltype>
<Xmltype>
<owner NAME="Legal Entity 1"></owner>
<LegalEntity NAME="Legal Entity 1"></LegalEntity>
<lob NAME="Line Of Business 2"></lob>
<Formula >B</Formula>
</Xmltype>
<Xmltype>
<owner NAME="Legal Entity 1"></owner>
<LegalEntity NAME="Legal Entity 1"></LegalEntity>
<lob NAME="Line Of Business 1"></lob>
<Formula>F</Formula>
</Xmltype>
</root>
I need XSLT for this.........
output should obtain like in HTML by using XSLT:
LegalEntityOwner:Legal Entity 1
LegalEntityName:LegalEntity
LobName:Line Of Business 1
Formula:A
Formula:B
Formula:C
Formula:D
Formula:B
Formula:F
LegalEntityOwner:Legal Entity 1
LegalEntityName:LegalEntity
LobName:Line Of Business 2
Formula:A
Formula:B
pleas can any one help!!!!

-
- Posts: 89
- Joined: Mon Mar 06, 2006 10:13 pm
Re: how to compare xml elemets in xslt
Muenchian grouping
http://www.jenitennison.com/xslt/groupi ... chian.html
http://www.jenitennison.com/xslt/groupi ... chian.html
Code: Select all
<xsl:key name="xmltypesByLob" match="Xmltype" use="lob/@NAME"/>
<xsl:for-each select="/root/Xmltype[count(.|key('xmltypesByLob', lob/@NAME)[1]) = 1]">
<xsl:text>LegalEntityOwner:</xsl:text>
<xsl:value-of select="owner/@NAME"><br/>
<xsl:text>LegalEntityName:</xsl:text>
<xsl:value-of select="LegalEntity/@NAME"><br/>
<xsl:text>LobName:</xsl:text>
<xsl:value-of select="lob/@NAME"><br/>
<xsl:for-each select="key('xmltypesByLob',lob/@name)/Formula">
<xsl:text>Formula:</xsl:text>
<xsl:value-of select="."/><br/>
</xsl:for-each>
<br/>
</xsl:for-each>
Return to “General XML Questions”
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