Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Updated >Thread Next - Re: Updated Re: UpdatedTo: NULL Date: 10/5/2004 12:36:00 PM Hi,
Something like...
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="kDistinctID" match="/*/*/*/@*" use="."/>
<!-- key for determining if a given attribute has an an attribute in its -->
<!-- parent/parent with the same name and a value of 'mappable' -->
<xsl:key name="kIsMappable" match="@*[. = 'mappable']"
use="concat(generate-id(..),'|',name())"/>
<xsl:template match="/">
<uniques>
<xsl:for-each select="/*/*/*/@*[name() = 'id' or
key('kIsMappable',concat(generate-id(../..),'|',name()))][generate-id() =
generate-id(key('kDistinctID',.)[name() = 'id' or
key('kIsMappable',concat(generate-id(../..),'|',name()))])]">
<unique id="{.}"/>
</xsl:for-each>
</uniques>
</xsl:template>
</xsl:stylesheet>
HTH
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.topxml.com/Xselerator
"Daniel" <softwareengineer98037@y...> wrote in message
news:%235u3HcnqEHA.2924@T......
> Let me re explain my question better then:
>
> Basically I would like there to be two ways for an attributes to get into
> the output document.
> 1. If the attribute's elements parent has an attribute with the same name
> and a value of "mappable"
> 2. If the attribute is named "id"
>
> As for this resulting list of id's I would like it to be a unique list.
> For example:
> <foo>
> <xs a="mappable" b="mappable" c="mappable">
> <x id="1111" a="2222" c="3333" house="home">
> <x id="4444" a="5555" c="6666" house="home">
> </xs>
> <ys j="mappable">
> <y id="7777" j="8888" house="home">
> </ys>
> </foo>
>
> to
>
> <uniques>
> <unique id="1111">
> <unique id="2222">
> <unique id="3333">
> <unique id="4444">
> <unique id="5555">
> <unique id="6666">
> <unique id="7777">
> <unique id="8888">
> </uniques>
>
>
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
