Subject: RE: XML Group with XSL
From: "Andreas L. Delmelle" <a_l.delmelle@xxxxxxxxxx>
Date: Thu, 22 Apr 2004 19:27:04 +0200
|
> -----Original Message-----
> From: aalikaj@xxxxxxxxxxxx [mailto:aalikaj@xxxxxxxxxxxx]
>
> I'm still trying to solve my problem.
>
> In a few words, i'm trying to explain my problem again.
>
> I have an XML file with this format:
>
Hi,
That sample looks a lot easier to handle than the one you posted yesterday.
Try this:
<xsl:stylesheet ...>
<xsl:key name="n-id-key" match="*[@ID]"
use="concat(count(ancestor::*),' ',name(),' ',@ID)" />
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="ROOT">
<xsl:copy>
<xsl:apply-templates select="*[generate-id()=generate-id(
key('n-id-key',concat(
'1 ', name(),' ',@ID)))]" />
</xsl:copy>
</xsl:template>
<xsl:template match="*">
<xsl:variable name="vcount" select="count(ancestor::*)+1" />
<xsl:copy>
<xsl:copy-of select="@*" />
<xsl:copy-of select="normalize-space(text())" />
<xsl:apply-templates select="../*[name()=name(current()) and
@ID=current()/@ID]/*[
generate-id()=generate-id(
key('n-id-key',concat(
$vcount,' ',name(),' ',@ID)))]" />
</xsl:copy>
</xsl:template>
Seems to be leading to the wanted result...
Hope this helps!
Cheers,
Andreas
| Current Thread |
- RE: XML Group with XSL, (continued)
- aalikaj - Wed, 21 Apr 2004 12:53:44 -0400 (EDT)
- aalikaj - Wed, 21 Apr 2004 15:08:44 -0400 (EDT)
- aalikaj - Thu, 22 Apr 2004 10:08:27 -0400 (EDT)
- Andreas L. Delmelle - Thu, 22 Apr 2004 13:19:38 -0400 (EDT) <=
- Michael Kay - Fri, 23 Apr 2004 02:59:34 -0400 (EDT)
|
|