[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to implement Divide and Conquer Algo on this t

Subject: Re: How to implement Divide and Conquer Algo on this template !! Getting Callstack overflow error
From: Dipesh Khakhkhar <dkhakhkh@xxxxxxxxxxxxxxx>
Date: Fri, 19 Sep 2003 10:34:19 -0400
divide and conquer xslt
Hi,

Thanks a lot for showing me efficient way of finding unique attribute names 
for the attributes.

Since the algorithm which i used is at many places throughtout my solution. 
And further processing was based on the output of that template i.e. unique 
names seperated with delimiter like this.

Applying the method shown below how do i get the unique names in a variable 
like
"a`b`c`m`X`Y`Z"

Actually i was getting output like this and I was doing further processing 
based on the output in the form like above.

So could you please tell me how do i get that in the variable and store it as 
shown above.

Thanks once again for your help.
Eagerly waiting for your reply.

Regards
Dipesh



>Do not try to use such kind of algorithm for obtaining unique attribute
names because it is inefficient.

>Read about grouping methods here:

>http://www.topxml.com/code/default.asp?p=3&id=v20010129150851

>and here:

>http://jenitennison.com/xslt/grouping/index.html


>Here's an example how to use the Muenchian method for grouping in order to 
obtain the unique attributes' names:


<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:output method="text"/>

<xsl:key name="kattNames"
match="firstNode/secondNode/@*" use="name()"/>

<xsl:template match="/">
<xsl:for-each
select="*/*/*/@*[generate-id()
=
generate-id(key('kattNames', name())[1])
]">
<xsl:value-of select="concat(name(), '&#xA;')"/>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

When this transformation is applied on the source.xml below:

<root>
<firstNode>
<secondNode a="x" b="y" c ="z"/>
<secondNode a="x" m="y" c ="z"/>
</firstNode>
<firstNode>
<secondNode a="x" X="y" c ="z"/>
<secondNode a="x" m="y" c ="z"/>
</firstNode>
<firstNode>
<secondNode Y="x" b="y" c ="z"/>
<secondNode a="x" m="y" Z ="z"/>
</firstNode>
</root>

the correct result is produced:

a
b
c
m
X
Y
Z


Hope this helped.


=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.