Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: numbering across elements

From: mike@--------------------.--.-- (---- -------)
To: NULL
Date: 10/5/2004 4:28:00 AM
ah yes, this makes sense now.

thanks for the help,
mike.

"Marrow" <marrow@s...> wrote in message news:<shf8d.126$9H6.28@n...>...
> Hi,
> 
> Try something like...
> 
> <?xml version="1.0"?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="xml" indent="yes"/>
> 
> <xsl:key name="kLookupB" match="b[@j='aaaa']" use="@i"/>
> 
> <xsl:template match="a">
>   <x>
>     <xsl:for-each select="c[key('kLookupB',@i)]">
>       <y i="{position()}" j="{@j}"/>
>     </xsl:for-each>
>   </x>
> </xsl:template>
> </xsl:stylesheet>
> 
> 
> HTH
> Marrow
> http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
> http://www.topxml.com/Xselerator
> 
> 
> "Mike Dickens" <mike@p...> wrote in message
> news:721b66d8.0410040823.33819f72@p......
> > hi,
> > i have a query regarding numbering one set of elements as filtered by
>  another set.
> > eg if i have
> >
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> > <a>
> >   <b i="1" j="aaaa"/>
> >   <b i="2" j="bbbb"/>
> >   <b i="3" j="aaaa"/>
> >   <c i="1" j="xxxx"/>
> >   <c i="2" j="yyyy"/>
> >   <c i="3" j="zzzz"/>
> > </a>
> >
> > and i want a numbered c/@j with the same @i as a, where a/@j = "aaaa", ie
>  i get
> >
> > <x>
> >  <y i="1" j="xxxx"/>
> >  <y i="2" j="zzzz"/>
> > </x>
> >
> > (note the @i sequence is 1,2 not 1,3)
> >
> > what would the xslt look like to do this?
> >
> > thanks,
> > mike.


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent