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

Re: finding unique nodes

Subject: Re: finding unique nodes
From: Jarkko.Moilanen@xxxxxx
Date: Fri, 23 Jan 2004 08:33:02 +0200
list of unique names
Take a look at here, Jeni demystifies the the usage of keys.

cheers,
Jarkko

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

Lainaus Paul Tremblay <phthenry@xxxxxxxxxxxxx>:

< I would like to find just the first element of certain nodes. My XML
< document looks something like this:
<
< <doc>
<
<   <para name = "Normal" left-indent = "18"> text</para>
<
<   <para name = "Normal" left-indent = "18"> more text</para>
<
<   <para name = "any possible name" left-indent = "5"> more text</para>
<
<   <para name = "any possible name" left-indent = "5"> some more text</para>
<
<   <border top-border = "1">
<
<     <para name = "another name" left-indent = "3"> text</para>
<
<   </border>
<
<   <table>
<    <row>
<     <cell><para name = "still another name" left-indent="2"> cell
< text</cell>
<    </row>
<   </table>
<
< </doc>
<
< I need my resulting document to look like this:
<
< <doc>
<
<   <table-of-styles>
<    <para-style name = "Normal" left-indent = "18"/>
<    <para-style name = "any possible name" left-indent = "3">
<     <para-style = "another name" left-indent = "3"/>
<     <para-style name = "still another name" left-indent="2"/>
<   </table-of-style>
<
<   <!--rest of the document-->
<
< </doc>
<
< Notice that I have just one para-style elelement for each name--one for
< "Normal", one for "another name", and one for "still another name", and
< so on.
<
< I need to then create a text string for each of the para-style elements.
< I cannot duplicate the string.
<
< Notice also that the para element can occur in many different places.
<
< I know to start with something like this:
<
< <xsl:template match = "doc">
<
<  <xsl:for-each select = "descendant::para">
<    <!--here is where I don't know what to do-->
<
<  </xsl:for-each>
<
<  <xsl:apply-templates/>
< </xsl:template>
<
< I think I have to use a generate-id function in my xsl:for-each loop?
< But I've never done this before.
<
< Thanks
<
<
<
<
< --
<
< ************************
< *Paul Tremblay         *
< *phthenry@xxxxxxxxxxxxx*
< ************************
<
<  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
<
<


***************************************************
* Jarkko Moilanen                                 *
* Dokumentoinnin kehittäjä                        *
* Profound XML technology Expert                  *
* DokuMentori Oy                                  *
* www.dokumentori.fi                              *
***************************************************

 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.