|
Subject: Re: [xsl] Updating Attribute Values From: Nathan Tallman <ntallman@xxxxxxxxx> Date: Fri, 16 Aug 2013 09:27:41 -0400 |
Thank you everyone for your comments. They gave me the clue I needed.
The below code is working for my situation, which transforms an
existing XML by updating dao[@href].
<xsl:template match="dao[@href]">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates />
<xsl:attribute name="href">
<!-- do stuff -->
</xsl:attribute>
</xsl:copy>
</xsl:template>
Nathan
On Thu, Aug 15, 2013 at 11:25 AM, David Carlisle <davidc@xxxxxxxxx> wrote:
> On 15/08/2013 15:41, 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>
>>
>> I'm using XSLT 2.0, Saxon 6.5.5.
>>
>> Thanks,
>> Nathan
>
>
>
> In addition to the other comments re XSLT version and namespaces, a template
> matching an attribute only does anything if you apply templates to that
> attribute. The default processing does not do that:
>
> <xsl:template match="dao">
> ... stuff..
> <xsl:apply-templates/>
> ..
> </xsl:template>
>
> would apply templates to child nodes of <dao> but not to its attributes.
>
> David
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Updating Attribute Values, David Carlisle | Thread | [xsl] XSD notation question, henry human |
| Re: [xsl] XSD notation question, henry human | Date | [xsl] format-number() issue, Nathan Tallman |
| Month |