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

RE: Changing the Attibute Value

Subject: RE: Changing the Attibute Value
From: "Buddhi D. Mahindarathne" <buddhi@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 21 Jul 2008 14:13:20 +0530
RE:  Changing the Attibute Value
I tried all the possible ways, But it still didn't work for me... :(

-----Original Message-----
From: Abel Braaksma [mailto:abel.online@xxxxxxxxx]
Sent: Monday, July 21, 2008 1:26 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  Changing the Attibute Value

Hi Buddhi,

In your code, you match VisualObject and there it stops: you select the
value of the contents (which is always a string), you create a variable
(but don't use it) and there\'s no new apply templates. So the expected
result from your code (without me actually running it) would be the
stringized value of your VisualObject nodes.

Your first question: what Attribute do you mean? There's no node named
"Attribute" and the only actual attribute I see is @xsi:type. Which you
can access by using "@xsi:type" syntax:

<xsl:value-of select="@xsi:type" />

Your second question: this can be done by using the copy template (which

you already have) and removing or changing the template for VisualObject

(see my remark above: it misses an apply-templates to continue the
matching process). After that, you add, for instance:

<xsl:template match="Name[. = 'ChamferedRectangle']">
    <xsl:copy>Fillet</xsl:copy>
</xsl:template>

HTH,
Cheers,
-- Abel --


Buddhi D. Mahindarathne wrote:
> Dear All,
>
> Following is my partial XSLT,
>
> 1. I am not able to access Attribute for changing it
> 2. How do I extract only "ChamferedRectangle" and place "Fillet"
>
>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> 	<xsl:template match="/">
> 		<xsl:apply-templates select="*"/>
> 	</xsl:template>
>     <xsl:template match="@* | node()">
> 	<xsl:copy>
> 	  <xsl:apply-templates select="@* | node()"/>
> 	</xsl:copy>
>     </xsl:template>
>
>    <xsl:template match="VisualObject[@xsi:type='CChamferEx']">

> 		<xsl:copy>
> 			<xsl:variable name="attribute" select = '.'/>
> 			<xsl:value-of select="CFilletEx"/>
> 		</xsl:copy>
> 	</xsl:template>
> </xsl:stylesheet>
>
> Buddhi D. Mahindarathne wrote:
>
>> Dear All,
>> I want to transform following using XSLT 1.0
>>
>> <VisualObject xsi:type="CChamferEx">
>> 	<maxQSwitch>133</maxQSwitch>
>>        <Address>Laser Job.Layer.ChamferedRectangle1</Address>
>>        <Name>ChamferedRectangle1</Name>
>>        <IsMark>true</IsMark>
>>        <Visible>true</Visible>
>> </VisualObject>
>>
>> And get the output like this:
>>
>> <VisualObject xsi:type="CFilletEx">
>> 	<maxQSwitch>133</maxQSwitch>
>>        <Address>Laser Job.Layer.Fillet1</Address>
>>        <Name>Fillet1</Name>
>>        <IsMark>true</IsMark>
>>        <Visible>true</Visible>
>> </VisualObject>
>>
>> Here are the things associated with this,
>>
>> 1. Attribute Change
>> 2. Change last part on DOT separated value (I need to keep the last
>> value with the "Fillet" like [Fillet1] - in the sample number "one")
>> 3. Change the Chamfer to Fillet, but need to keep the last number
like
>> above case.
>>
>> Please help me on this.
>>
>> - Regards
>>   ____            _     _ _     _
>>  | __ ) _   _  __| | __| | |__ (_)
>>  |  _ \| | | |/ _` |/ _` | '_ \| |
>>  | |_) | |_| | (_| | (_| | | | | |
>>  |____/ \__,_|\__,_|\__,_|_| |_|_|

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.