Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 28th, 2008, 12:05 PM
Authorized User
 
Join Date: Feb 2008
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default how t do comparision of elements in xsl

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!!!!:(

 
Old February 28th, 2008, 12:21 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

So you want to group the Xmltype elements by the lob/@NAME attribute, right?
Do you want to use XSLT 1.0 or 2.0?
With XSLT 1.0 you can use the Muenchian grouping approach, with XSLT 2.0 you can simply use xsl:for-each-group select="Xmltype" group-by="lob/@NAME".
 
Old February 28th, 2008, 12:27 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Read about XSLT grouping. It's easier in 2.0 using xsl:for-each-group. For 1.0 approaches see http://www.jenitennison.com/xslt/grouping.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to group xsl elements in xslt.10 suji XSLT 1 February 29th, 2008 03:44 AM
Selecting Elements at Runtime to Display using XSL pnviv XSLT 1 November 22nd, 2007 05:08 AM
Adding elements from an XML to XSL. AjayLuthria XSLT 1 May 1st, 2007 12:12 PM
cdata-section-elements in xsl:output ROCXY XSLT 1 March 2nd, 2006 11:44 AM
Dynamically Finding Elements in XSL tclancy XSLT 2 March 1st, 2006 03:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.