[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Testing attribute name and replacing them with oth

Subject: Re: Testing attribute name and replacing them with other attribute name
From: "Joris Gillis" <roac@xxxxxxxxxx>
Date: Mon, 05 Sep 2005 19:28:35 +0200
nge attributes
Hi,

Tempore 17:11:04, die 09/05/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Thomas Winkler <thomasm003@xxxxxxxx>:

I want to find some attributes by name and then
replacing them with other attributes (actually doing
language transformation) :

for example

<tshirts size="XXL" brand="Nike" price="14">

should be changed into :

<tshirts lC$nge="XXL" marke="Nike" preis="14">

How can this be done ?

This is a typical job for an identity transformation:


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" indent="yes"/>

<xsl:template match="node()|@*">
	<xsl:copy>
		<xsl:apply-templates select="node()|@*" />
	</xsl:copy>
</xsl:template>

<xsl:template match="@size">
	<xsl:attribute name="lC$nge"><xsl:value-of select="."/></xsl:attribute>
</xsl:template>

<xsl:template match="@brand">
	<xsl:attribute name="marke"><xsl:value-of select="."/></xsl:attribute>
</xsl:template>

<xsl:template match="@price">
	<xsl:attribute name="preis"><xsl:value-of select="."/></xsl:attribute>
</xsl:template>

</xsl:stylesheet>

But perhaps the language-string mapping is already done in some XML file. In that case, you load that in the XSLT.

regards,
--
Joris Gillis (http://users.telenet.be/root-jg/me.html)
B+Error, keyboard not foundb press F1 to continueB; , BIOS

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.