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

How to extract value of variable number of attributes

Subject: How to extract value of variable number of attributes in an XML t ag through XSL?
From: "Govil, Anoop (Contractor)" <Anoop.Govil@xxxxxxxxxxxxxxxx>
Date: Tue, 16 Nov 2004 09:38:11 -0500
extract value from html
Hello,

I have a question regarding how to extract the attributes of an XML tag.
Here is sample XML:

<PAGE>
	<Table_Details>
		<table align="center" bgcolor="#cccccc" border="1"
height="45" width="350">
		<tr align="center" bgcolor="#cccccc" valign="middle">
		<td bgcolor="#cccccc">
		row 1 cell 1
		</td>
		<td align="" bgcolor="" colspan="" height="" nowrap=""
rowspan="" valign="" width="">
		<b>row 1 cell 2</b>
		</td>
		</tr>
	</Table_Details>
</PAGE>

Now, I need to get the attribute of the <table>, <tr> and <td> tags which
are under 	<Table_Details> parent tag. My problem is that I don't know
for sure how many attributes each of these (table, tr and td) tags may have,
they may have zero to multiple attributes. For example in above example,
under 'td' there are variable number of attributes and the total number is
not fixed. I have to output all these attributes that currently exist in
each of these tags (table, tr and td) and also add some more fixed
attributes such as class="", etc. for each of these (table, tr and td). 

If I could loop through the list of attributes in these, it could be easy to
implement so that I could get to table tag and loop through its attributes
list and add more attributes also. But I don't know how to do that. Because
I don't know for sure what attributes may be present each time, I can't
hardcode each attribute's value in final output. Please suggest if there
could be an implementation for what I am trying to do.

Thanks in advance.

Anoop

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.