xsl-list
[Top] [All Lists]

Re: [xsl] Merging data based on attributes

2006-08-23 10:02:21

    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>

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>