I'm trying to get a variant on the XSLT cookbook template to output csv
http://books.google.co.uk/books?id=6q50V7oykqEC&lpg=PP1&pg=PA240#v=onepage&q=delimiter&f=false
Page 240-241
It uses XSLT 2.0 and parts of it are quite neat.
I like the idea of importing a generic module, and then defining the
columns to export in the importing module.
I want to extend it to hand different delimiters, in the same way, and
also different line terminators.
The next extension is correctly quoting the output if it containts
quotes in strings etc.
So far, I can do this.
However, there is one problem I can't solve.
My input data is not regular, but CSV output needs to be regular. So I
want to defined the column names like this
<xsl:variable
name="columns"
select="
'trade',
'trade',
'currency',
'isin'
"
as="xs:string*"
/>
and the path names to get the data like this
<xsl:variable
name="nodepaths"
select="
'tradeid',
'trader',
'currency',
'instrument/isin'
"
as="xs:string*"
/>
The interesting part is the isin. To get the path from the input
fragment, it is an xpath.
So if I had
<xsl:variable name="path" select="instrument/isin" as="xs:string"/>
and
<xsl:variable name="message">
<message>
<trade>
<tradeid>1</tradeid>
<trader>Nick</trader>
<currency>USD</currency>
<instrument>
<isin>US0123456789</isin>
</instrument>
<trade>
</message>
<xsl:variable>
I want to do something like
<xsl:value-of select="$message/$path"/>
and have it return US0123456789
What's the best way?
--
Nick
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--