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

Re: Problem with generating references.

Subject: Re: Problem with generating references.
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Tue, 05 Jul 2005 14:48:41 +0200
generating substring
Tempore 14:57:07, die 07/05/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Lakshmi narayana <lchintala@xxxxxxxxxxxx>:

for each element so that I can identify each element uniquely).

1. Divide the elements into groups.
2. While dividing, create the references to the elements in the current
group which are going to be placed in another group.

This stylesheet generates the ouput from your sample. It will need some adaption though, to work in a real situation.


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>
<xsl:key name="element" match="*" use="substring(local-name(),1,1)"/>


<xsl:template match="/">
<xsl:for-each select="//*[generate-id()=generate-id(key('element',substring(local-name(),1,1)))]">
<xsl:element name="{substring(local-name(),1,1)}-group">
<xsl:for-each select="key('element',substring(local-name(),1,1))">
<xsl:copy>
<xsl:for-each select="*">
<reference><xsl:attribute name="id"><xsl:number count="*" level="any"/></xsl:attribute></reference>
</xsl:for-each>
</xsl:copy>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
</xsl:template>


</xsl:stylesheet>


regards, -- Joris Gillis (http://users.telenet.be/root-jg/me.html) Spread the wiki (http://www.wikipedia.org)

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.