[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] finding unique nodes

Subject: [xsl] finding unique nodes
From: Paul Tremblay <phthenry@xxxxxxxxxxxxx>
Date: Fri, 23 Jan 2004 01:03:25 -0500

I would like to find just the first element of certain nodes. My XML
document looks something like this:


  <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>


    <cell><para name = "still another name" left-indent="2"> cell text</cell>


I need my resulting document to look like this:


   <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"/> 

  <!--rest of the document-->

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-->



I think I have to use a generate-id function in my xsl:for-each loop?
But I've never done this before.



*Paul Tremblay         *

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

Current Thread