This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Generate tab-delimited file



<!-- This will generate row data
<xsl:template match="topic/@*">
	<xsl:value-of select="." />
	<xsl:text>&#x9;</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>&#x9;</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>&#x9;</xsl:text>
</xsl:for-each>
<xsl:text>&#x10;</xsl:text>
<xsl:for-each select="*">
 <xsl:value-of select="." />
 <xsl:text>&#x9;</xsl:text>
<xsl:text>&#x10;</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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]