Re: [xsl] Merging data based on attributes

Subject: Re: [xsl] Merging data based on attributes
From: David Carlisle <davidc@xxxxxxxxx>
Date: Wed, 23 Aug 2006 18:02:04 +0100
    xmlns:xs="http://www.w3.org/2001/XMLSchema";
you don't need to declare this namespace

    xmlns:fn="http://www.w3.org/2005/02/xpath-functions";
    xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes";>

you don't need to declare these eithera nd shouldn't as they are specific
to specific drafts of XPath (and xdt isn't used at all in teh current
draft)

You do however need to declare the svg namespace, as otherwise you can
not match on svg elements.

This seems to do what you need:


<xsl:stylesheet version="2.0"
		xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
		xmlns="http://www.w3.org/2000/svg";
		xmlns:svg="http://www.w3.org/2000/svg";
		exclude-result-prefixes="svg"
		>


<!-- copies all nodes/attributes into result tree unchanged -->
<xsl:template match="@*|node()">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>

<xsl:template match="svg:text[.=('element','phase')]">
  <text>
    <xsl:copy-of select="@*"/>
    <xsl:value-of select="key(.,../@id,doc('textsrc.xml'))"/>
  </text>
</xsl:template>

<xsl:key name="element" match="element" use="../@id"/>
<xsl:key name="phase" match="phase" use="../@id"/>

</xsl:stylesheet>

Current Thread