xsl-list
[Top] [All Lists]

Re: [xsl] Updating Attribute Values

2013-08-15 09:59:37
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(_at_)CraneSoftwrights(_dot_)com 
|
Google+ profile: https://plus.google.com/116832879756988317389/about |
Legal business disclaimers:    http://www.CraneSoftwrights.com/legal |


--~------------------------------------------------------------------
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>