Re: XSL Copy

Subject: Re: XSL Copy
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 11 Apr 2000 17:51:39 +0100 (BST)
> However, when I run this the tag names are stripped off from the output and
> I only get the node contents. What am I doing wrong?

tags don't have names (elements do)

For the root node and almost all its descendents, you have not specified
any template, so you get the default template which just recurses on the
children and finally copies the character data to the result.

<xsl:template match="//timeSeriesDetail/timeSeries[timeSeriesType=$tsType
and timeSeriesKey=$tsName]">

using // is almost always inefficient, or just plain wrong, and never
makes sense in a match pattern.

What I think you want is

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
version="1.0">
  <xsl:param name="tsType" select="Equity"/>
  <xsl:param name="tsName" select="DAX"/>

<xsl:template match="/">
<xsl:copy-of select="results/timeSeriesDetail[
      timeSeries/timeSeriesType=$tsTyp
       and
      timeSeries/timeSeriesKey=$tsName]"/>
</xsl:template>

</xsl:stylesheet>

but its hard to be sure...

David


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread