473,395 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to tranform an XML tag value to an atrribute value

su
HI,

I want to tranform following
<extends>/public/a1.xml</extends>

into
<extends xlink:type="simple" xlink:href="/public/a1.xml"></extends>

using XSL.

How does the code should look like in XSL file??

Sumit

Jan 16 '06 #1
2 1039


su wrote:
I want to tranform following
<extends>/public/a1.xml</extends>

into
<extends xlink:type="simple" xlink:href="/public/a1.xml"></extends>

using XSL.


<xsl:template match="extends">
<xsl:copy>
<xsl:attribute name="xlink:type"

namespace="http://www.w3.org/1999/xlink">simple</xsl:attribute>
<xsl:attribute name="xlink:href"

namespace="http://www.w3.org/1999/xlink"><xsl:value-of
select="."/></xsl:attribute>
</xsl:copy>
</xsl:template>

is one way that is rather generic, it might suffice to use the much shorter

<xsl:template match="extends">
<extends
xlink:type="simple"
xlink:href="{.}"
xmlns:xlink="http://www.w3.org/1999/xlink" />
</xsl:template>

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jan 16 '06 #2
su
Hi Martin, Thanks for the solution,
In the mean time I wrote this code and it worked:-

<xsl:template match="extends">
<xsl:variable name="xdbextend">
<xsl:value-of select="."/>
</xsl:variable>
<extends xlink:href="{$xdbextend}" xlink:type="simple"
xlmns:xlink="http://www.w3.org/1999/xlink">>
</extends>

Thanks .

Jan 16 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: G Kannan | last post by:
Hey all! I have written a perl script to retrieve information from a HTML Form and insert the data into an Oracle database table. I am gettting the the following error message: "Use of...
2
by: Anthony | last post by:
I have an inventory database that Im trying to create a report out of the IP address are a lookup on a seperat table but I keep getting the above error can I change the table row to something to...
0
by: Bill Sneddon | last post by:
The XSL code below generates the correct output for my html file. I would like to run the transform once and have the the $yearM variable be updated in the HTML. I have played around with it and...
3
by: otto | last post by:
i need to read a variable in a javascript and translate it to a form in html the javascript variable is: <SCRIPT LANGUAGE='JavaScript'>RF2N('Total');</script> and i need to put that...
1
by: koen colen | last post by:
Hello group, I hope you guys can help me out, I am modifying a piece of code from Joe Norman, I did found the code here: http://www.intranet2internet.com/public/default.asp?PAGE=sscript&ID=3 ...
3
by: Eric Chang | last post by:
I was working on this simple form with radio boxes. And when I click on one of the radio box, it tell me the value is "undefined" Why is that ? I did defined the value of each radio box: ...
16
by: cwizard | last post by:
I'm calling on a function from within this form, and there are values set but every time it gets called I get slammed with a run time error... document.frmKitAmount.txtTotalKitValue is null or not...
0
by: David Mediavilla | last post by:
I am trying to check a SOAP signature with WSE 1.0 SP1, but with a certain transform I only get an "Unknown tranform" exception. The SOAP signature is like this: <ds:Signature>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.