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]

Global location path confusion


Hi everybody!

XSLT is quite new to me so please forgive me if this is a stupid question.

I have the following XSLT stylesheet:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
version="1.0">

  <xsl:template match="doc">
   <doc>
     <xsl:apply-templates/>
   </doc>
  </xsl:template>
 
  <xsl:template match="a">
   <x title="{/doc/@title}"/>
  </xsl:template>
 
  <xsl:template match="b">
   <xsl:param name="content">
     <a/>
   </xsl:param>
   <xsl:apply-templates select="$content"/>
  </xsl:template>
  
</xsl:stylesheet>

Then I feed it the following xml:

<?xml version="1.0" encoding="iso-8859-1"?>

<doc title="abc">
  <a/>
  <b/>
</doc>

This results in the following output xml:

<doc>
  <x title="abc"></x>
  <x title=""></x>
</doc>

My question:
Why does the second "abc" get eaten up?
Why doesn't it result in this?

<doc>
  <x title="abc"></x>
  <x title="abc"></x>
</doc>

I tried this with xalan-c as well as saxon.



 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]