Stefan Eickhoff: erledigt

Beitrag lesen

Hallo,

so ich habe jetzt doch "self" eine funktionierende Version hinbekommen.
Kommentare und Verbesserungsvorschläge sind natürlich immer noch willkommen.
Hier mein vorläufiges Endergebnis.

test.xml
--------

<?xml version="1.0" encoding="UTF-8"?>

<root xmlns:tmp="http://example.org/tmp">

<title tmp:id="A">Test</title>
 <page tmp:id="B" id="A">
 <head>Ohne Attribut</head>

<text id="A" tmp:id="B"></text>
  <foot id="A"></foot>

</page>

</root>

test.xsl
--------
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:tmp="http://example.org/tmp"
xmlns:dyn="http://exslt.org/dynamic"
extension-element-prefixes="dyn"

<xsl:template match="@*|node()">
    xsl:copy
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

<xsl:template match="@tmp:*">

<xsl:if test="not(dyn:evaluate(concat('../@', local-name(.))))">
    <xsl:attribute name="{local-name(.)}"><xsl:value-of select="." /></xsl:attribute>
   </xsl:if>
  </xsl:template>
</xsl:stylesheet>

Viele Grüße

Stefan