|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Hopefully not a terribly silly question
Morgan,
You are trying to fish out the column name every time you need it.
Better to make a list of them once in a global variable:
<xsl:variable name="col-names" select="/result/row[1]/column/@name" />
<!-- that gives you a node-set with the name attributes in document
order -->
Then instead of
> <xsl:value-of select="concat('/result/row[1]/column[', position(),']/@name')"/>
try
<xsl:variable name="col-no" select="position()" />
<xsl:value-of select="$col-names[$col-no]" />
to give you the name of the current column. (Don't put position()
directly, because it changes its value according to the context).
>Unfortunately, I get a the literal string result of the concat()
>function, instead of the actual data value. Is there some sort of
>eval() function that I need to use? Am I approaching this incorrectly?
> I know that XSL is quite a paradigm shift from traditional programming
>methods.
True. You can improve this a lot by letting templates do the work for
you instead of explicitly navigating the source tree. I also think
you are going to miss the first row of data: you want to print the
column headings *and* the values on the first row, not just the names.
There isn't a standard 'eval' function BTW, though some processors
have it as an extension function.
Regards,
Trevor Nash
--
Traditional training & distance learning,
Consultancy by email
Melvaig Software Engineering Limited
voice: +44 (0) 1445 771 271
email: tcn@xxxxxxxxxxxxx
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








