Subject: RE: Change Attribute Value: Search-n-replace is better?
From: sara.mitchell@xxxxxxxxx
Date: Tue, 21 Dec 1999 16:23:38 -0500
|
I'm not sure that this is the problem, but I did notice
two issues. First, the <xsl:text> is not necessary
in your attribute instruction. Second, the <xsl:apply-templates>
is selecting all children elements AND ALL ATTRIBUTES.
I think that this ends up selecting the existing meter
attribute which you do not want to do.
I haven't tested this, but I think the following
may be part of what you need:
...
<div2>
<xsl:attribute name="meter">gayatri</xsl:attibute>
<xsl:apply-templates select="*|@*[not(name()='meter')]"/>
</div2>
Hope this helps,
Sara
> -----Original Message-----
> From: John Robert Gardner [mailto:jrgardn@xxxxxxxxx]
> Sent: Tuesday, December 21, 1999 7:24 PM
> To: 'xsl-list@xxxxxxxxxxxxxxxx'
> Subject: Change Attribute Value: Search-n-replace is better?
>
>
>
> Herein I cast myself upon the altar of public shame with what
> should be
> obvious, I'm sure.
>
> Suppose I have an xml file with a bunch of TEI div tags, and
> I know that I
> want to change an attribute value for one of those tags, but
> I don't know
> the existing value for the attribute "type."
>
> If I do this:
>
> <xsl:template match="div2[@id='1.2']">
> <div2>
> <xsl:attribute name="meter">
> <xsl:text>gayatri</xsl:text>
> </xsl:attribute>
> <xsl:apply-templates select="*|@*" />
> </div2>
> </xsl:template>
>
> I'm still not changing the value of "meter." You see, folks can
> transliterate Sanskrit and make typo's zillions of ways.
> WHen many cooks
> stir this vichy soisse, untangling how they do things is a
> zoo. So, I can
> select teh hymn I want to make be meter "gayatri", but I can't seem to
> make gayatri replace _whatever_ value is currently assigned
> to "meter."
>
> I mean, I can guess some sort of choose/when or if test, but
> is that the
> only way? It seems like using a canon to swat a fly . . . . hence,
> search-n-replace is better?
>
> Somewhere {} must figure in this, but I'm fully penitent and
> confessional
> of not knowing how. . . .
>
> =-=-=-=-=-=-=-=-=-==-=-=-=
> John Robert Gardner
> ATLA-CERTR
> Emory University
> ------------------------------------------------------------
> http://vedavid.org/diss/
> "If there is something you're thinking of doing, or wish you could do,
> begin it. In boldness there is mystery and power . . . . " -Goethe
>
>
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|