This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Generate tab-delimited file
- To: xsl-list at lists dot mulberrytech dot com
- Subject: Re: [xsl] Generate tab-delimited file
- From: David Carlisle <davidc at nag dot co dot uk>
- Date: Thu, 5 Jul 2001 15:58:22 +0100
- References: <09253863F113D111A55200805F19B93508A3AC91@SERVER3>
- Reply-To: xsl-list at lists dot mulberrytech dot com
<!-- This will generate row data
<xsl:template match="topic/@*">
<xsl:value-of select="." />
<xsl:text>	</xsl:text>
</xsl:template>
-->
That generates nothing.
It matches any attribute of topic, but
a) <topic> has no attributes and
b) even if it did the template would never be applied as you never
use <xsl:apply-templates to apply templates to attributes (or even
elements)
> 1. it just looks for the immediate nodes who are the children of <topic>.
The default template rule recursively applies templates so processes the
whole tree, you stopped that by
<xsl:template match="topic/*">
<xsl:value-of select="name()" />
<xsl:text>	</xsl:text>
</xsl:template>
which says that for childeren of topic do not use apply-templates, so do
not process their children.
Probably you want something like
<xsl:template match="topic">
<!-- header -->
<xsl:for-each select="*">
<xsl:value-of select="name()" />
<xsl:text>	</xsl:text>
</xsl:for-each>
<xsl:text></xsl:text>
<xsl:for-each select="*">
<xsl:value-of select="." />
<xsl:text>	</xsl:text>
<xsl:text></xsl:text>
</xsl:for-each>
</xsl:template>
> 2. but if I have something like this
I haven't tried to answer that as it is completely under specified,
which elements you need to produce headers and which elements you
ignore and process children.
David
_____________________________________________________________________
This message has been checked for all known viruses by Star Internet
delivered through the MessageLabs Virus Scanning Service. For further
information visit http://www.star.net.uk/stats.asp or alternatively call
Star Internet for details on the Virus Scanning Service.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list