Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Updated

From: "Marrow" <m--a-r-r-o-w@--------------------.--->
To: 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>
>
>




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