[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Updating Attribute Values


Subject: Re: [xsl] Updating Attribute Values
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Thu, 15 Aug 2013 10:59:19 -0400

At 2013-08-15 10:41 -0400, Nathan Tallman wrote:
I'd like to change the values of attribute "href", whenever it appears
inside a "dao" element. From what I can tell, my template is correct,
however when ever I stick anything inside xsl:attribute (replace <!--
do stuff here -->, nothing happens during the transformation. Am I
missing something?

    <xsl:template match="@href[parent::dao]">
        <xsl:attribute name="href">
            <!-- do stuff here -->
        </xsl:attribute>
    </xsl:template>

In order to add an attribute to the result tree you are obliged to have just previously added an element to the result tree (and possibly other attributes to that element). Otherwise, there is no node to attach the attribute to.


I'm using XSLT 2.0, Saxon 6.5.5.

Unlikely ... Saxon 6.5.5 only supports XSLT 1.0.


I hope this helps.

. . . . . . Ken

--
Public XSLT, XSL-FO, and UBL classes in the Netherlands     Oct 2013 |
Public XSLT, XSL-FO, UBL and code list classes in Australia Oct 2013 |
Contact us for world-wide XML consulting and instructor-led training |
Free 5-hour lecture: http://www.CraneSoftwrights.com/links/udemy.htm |
Crane Softwrights Ltd.            http://www.CraneSoftwrights.com/s/ |
G. Ken Holman                   mailto:gkholman@xxxxxxxxxxxxxxxxxxxx |
Google+ profile: https://plus.google.com/116832879756988317389/about |
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal |


Current Thread
Keywords