This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Generate tab-delimited file
- To: XSL-List at lists dot mulberrytech dot com
- Subject: [xsl] Generate tab-delimited file
- From: Benoit_Aumars at jltgroup dot com
- Date: Thu, 5 Jul 2001 15:29:36 +0100
- Reply-To: xsl-list at lists dot mulberrytech dot com
Hi all,
Another help requested.
Here is my XML source :
<?xml version="1.0"?>
<topic>
<id>123</id>
<dob>
<Year>2001</Year>
<Month>07</Month>
<Day>01</Day>
</dob>
<b>Item</b>
<c code="12">xyz</c>
<d code="34"></d>
<e/>
</topic>
and my XSL :
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:strip-space elements="*"/>
<xsl:output method="text"/>
<!-- This will generate the column data -->
<xsl:template match="topic/*">
<xsl:value-of select="name()" />
<xsl:text>	</xsl:text>
</xsl:template>
<!-- This will generate row data
<xsl:template match="topic/@*">
<xsl:value-of select="." />
<xsl:text>	</xsl:text>
</xsl:template>
-->
</xsl:transform>
and the result is :
id dob b c d e
I would like the output ( tab-delimited file ) as follow :
id dob b c d e
123 20010701 Item xyz
The problem with my XSL :
1. it just looks for the immediate nodes who are the children of <topic>.
So if I have something like this :
<f>
<g>ItemG</g>
</f>
it should pick <g> for 'g' column with 'ItemG' as row data, but it picks
'f', wrong of course.
Sounds like : 'select the name of the context node which is the lowest
children' ...?
2. but if I have something like this
<f>
<g>
<Year>2001</Year>
<Month>07</Month>
<Day>31</Day>
</g>
</f>
it should pick <g> for 'g' column with '20010731' as row data.
Sounds like : 'if the lowest node is <Year>, pick up its parent, hence <g>'
...?
Any idea ?
Thanks for your help.
Benoit Aumars.
************************************************************
JLT Management Services Limited
6 Crutched Friars, London EC3N 2PH. Co Reg No 1536540
Tel: (44) (0)20 7528 4000 Fax: (44) (0)20 7528 4500
http://www.jltgroup.com
------------------------------------------------------------
The content of this e-mail (including any attachments) as
received may not be the same as sent. If you consider that
the content is material to the formation or performance of
a contract or you are otherwise relying upon its accuracy,
you should consider requesting a copy be sent by facsimile
or normal mail. The information in this e-mail is
confidential and may be legally privileged. If you are not
the intended recipient, please notify the sender immediately
and then delete this e-mail entirely - you must not retain,
copy, distribute or use this e-mail for any purpose or
disclose any of its content to others.
Opinions, conclusions and other information in this e-mail
that do not relate to the official business of JLT
Management Services Limited shall be understood as neither
given nor endorsed by it. Please note we intercept and
monitor incoming / outgoing e-mail and therefore you should
neither expect nor intend any e-mail to be private in nature.
We have checked this e-mail for viruses and other harmful
components and believe but not guarantee it virus-free prior
to leaving our computer system. However, you should satisfy
yourself that it is free from harmful components, as we do
not accept responsibility for any loss or damage it may
cause to your computer systems.
************************************************************
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list