[xsl] XSL Newbie: How2 write transforms for variable XML

Subject: [xsl] XSL Newbie: How2 write transforms for variable XML
From: Joe Weder <jweder@xxxxxxx>
Date: Thu, 27 Jan 2005 15:25:08 -0500
I'm sure there is some way to create XSL that can work for limited variability in XML content.

Simple example, consider a report that yields columnar data in which the columns in the report will vary - which columns and their order:

Sample1.xml
<data>
<row>
   <attrA>red</attrA>
   <attrB>128</attrB>
</row>
</data>

Sample2.xml
<data>
<row>
   <attrC>foo</attrC>
   <attrX>12.00</attrX>
   <attrB>128</attrB>
</row>
</data>

I want to know how I can develop XSL to handle the data without hard-coding selects for specific names (attrA, attrB, attrC, attrD). Additionally, I want to be able to define rules for each column. Like justification, color, bold, etc. - would this be some kind of meta-data or processing instructions?

Any suggestions would be greatly appreciated.

Forgive me if this is well understood, I could not find anything in the archive 'cause I was probably not searching for the right keywords.

--
Joe Weder
Senior Software Developer/Architect
Intelligent Computer Systems
A Division of Global Beverage Group
717.295.7977 ext 614
www.gbg.com

Current Thread