Subject: Re: [xsl] finding unique nodes From: Jarkko.Moilanen@xxxxxx Date: Fri, 23 Jan 2004 08:33:02 +0200 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
[xsl] finding unique nodes, Paul Tremblay | Thread | Re: [xsl] finding unique nodes, Paul Tremblay |
[xsl] finding unique nodes, Paul Tremblay | Date | [xsl] extracting all elem names of , Saverio Perugini |
Month |