XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
priya narayanSubject: Xml to html conversion
Author: priya narayan
Date: 17 Jul 2006 05:06 PM
Hi,

I am novice to xslt and was looking for some good solution to a problem. I have an xml file that is generated dynamically and randomly. User can select what columns of the xml should be outputed.

example:
<XML_Ds>
<Table>
<Col1>column 1</Col1>
<Col2>column 2</Col2>
<Col3>column 3</Col3>
</Table>
<Table>
.....
</Table>
</XML_Ds>

There can also be some other XML file with 5 coulmns and with different column names. Depending on the columns selected by the user, I want to pass the columns as parameters and process the xml file so that only coulmns user needs is displayed.

It would be really great if you guys can provide me some ideas about how a generic solution can be developed.

Thanks,
Priya

Postnext
Ivan PedruzziSubject: Xml to html conversion
Author: Ivan Pedruzzi
Date: 17 Jul 2006 10:56 PM
Hi Priya,

Attached you can find one of many possible solutions.

To keep the code simple and XSLT 1.0 compliant, you will need to format the parameter value as
list of column names separated by space, also the list needs to start and to end with a space.


Hope this helps
Ivan Pedruzzi
Stylus Studio Team


Documentcolumns.zip

Posttop
priya narayanSubject: Xml to html conversion
Author: priya narayan
Date: 18 Jul 2006 11:50 AM
Hi,

Thanks for the solution. I also have couple more question for you.

1) I also want to add header columns in the table and let's say that the header columns are in some delimited strings like below

<xsl:param name="columns" select="'$header1$header2$header3$'" />

If want it to be displayed as
<head>
<th><td>header1</td></th>
<th><td>header2</td></th>
<th><td>header3</td></th>
</head>

2) In your attached document, can I use someparameter for node set XML_Ds/Table instead of hardcoding in the xsl file.
<xsl:for-each select="XML_Ds/Table">

Thanks very much for your help.
- Priya

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.