[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Change Attribute Value: Search-n-replace is better?
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
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|