473,395 Members | 2,798 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.

XSL Value of for an attribute

I am new to XML/XSL formatting so have a fundamental question/problem. I have two formats of XML data that I require to format, the first XML file (which is under my control) uses child elements as shown below :

<Card>
<IPAddress>192.168.0.22</IPAddress>
<Slot>2</Slot>
<Card_Type><![CDATA[HSU10]]></Card_Type>
<User_Label><![CDATA[TX Line1 HD O/P]]></User_Label>
<Card_Description>HD-SDI Up-Converter</Card_Description>
<SW-Version>1211</SW-Version>
<HW-Version>0101</HW-Version>
<Product-Code>9490200001</Product-Code>
<Serial-Number>000687</Serial-Number>
<Card-ID>6400000AEDFD6201</Card-ID>
</Card>

and I format these in the XSL into a table

<xsl:for-each select="inventory/Frame/Card">
<tr>
</xsl:comment>
<td>
<xsl:value-of select="IPAddress"/>
</td>
.....
</tr>
</xsl:for-each>

which works well. However the second XML file I have is not under my control and uses attributes as shown below:

<ROW IPAddress="10.1.1.5" Slot="4" GroupID="2" ObjectID="84" ObjectLabel="GPI_6" ObjectType="4" ObjectValue="0" />

What I want to do and cannot find a way to do is format these attributes in a similar way but the value-of does not work

<xsl:for-each select="_LiveConfig/ROWDATA/ROW">
<tr>
<td><xsl:value-of select="IPAddress"/></td>
<td><xsl:value-of select="Slot"/></td>
<td><xsl:value-of select="GroupID"/></td>
<td><xsl:value-of select="ObjectID"/></td>
....
</tr>
</xsl:for-each>

Can someone give me some guidance as to why this does not work and which command I should be using.

Many thanks
Nov 29 '07 #1
1 1375
jkmyoung
2,057 Expert 2GB
Use @ before the name to show that it's an attribute.
eg: select="@IPAddress"
Nov 29 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: TekWiz | last post by:
I've got a system that automatically generates a form. I have it set up so that the backend will return to the inital form page with an error object in sessions data (assuming the backend detected...
4
by: Lénaïc Huard | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hello, I've some namespace problems when defining default values for attributes. My problem seems to come from the fact that the attributes are...
2
by: Eshrath | last post by:
Hi, What I am trying to do: ======================= I need to form a table in html using the xsl but the table that is formed is quite long and cannot be viewed in our application. So we are...
2
by: TadPole | last post by:
Hi all, My main problems are::::::::: 1. Set a value within a block container that can be used and changed by subsequent templates/block-containers/tables etc.. 2. get/determine/find the...
10
by: Jon Noring | last post by:
Out of curiosity, may a CDATA section appear within an attribute value with datatype CDATA? And if so, how about other attribute value datatypes which accept the XML markup characters? To me,...
5
by: Simon | last post by:
Hi all, I am writing a windows application using vb.net on the 1.1 framework. We have in the application, some strongly typed collections that have been written as classes that do not inherit...
8
by: patrizio.trinchini | last post by:
Hi All, I'would like to write an XSL transformation that changes the value of the atribute of a given element according to the value of another atttribute of the same element. For instance,...
3
by: patrizio.trinchini | last post by:
Hi, how can remove sibling elements based on the value of an attribute ? For instance, gven the XML document: <root> <parentElment> <testElement name="A"> <removableElement/>
275
by: Astley Le Jasper | last post by:
Sorry for the numpty question ... How do you find the reference name of an object? So if i have this bob = modulename.objectname() how do i find that the name is 'bob'
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.