XSL - Tags uniek maken

Uit De Vliegende Brigade
Naar navigatie springen Naar zoeken springen

Het probleem

Hoe zorg ik ervoor, dat in een XML-bestand zoiets als dit:

  <Items>
    <Item code="00000001" type="S" searchcode="00000001">
      <Description>Zahlungskosten</Description>

wordt omgefietst naar dit?

  <Items>
    <Item code="00000001" type="S" searchcode="00000001">
      <Item_Description>Zahlungskosten</Item_Description>

Aanvullende gegevens

  • De rest van het bronbestand moet intact blijven

Brainstorm

Gebruik meerdere templates

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<xsl:strip-space elements="*" />

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

<xsl:template match="Description" />
   <xsl:copy>
      <Item_Description>
         <xsl:value-of select="ancestor::assignment/assignment-record/reel-no"/>


</xsl:stylesheet>