[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Trouble using document()

Subject: Trouble using document()
From: "mwebster" <mwebster@xxxxxxxxxxxxxxx>
Date: Fri, 10 Jun 2005 01:10:28 -0700
select document
Sorry if I have included too much or too little of my XSL document.  This
section is attempting to replace a recursive solution that worked well in
Saxon but causes a stack overflow error in XALAN.

Basically, I want to use the known number of nodes in 

document($nodeFileName)/nodes/n

to go through my smaller list of stats in my main XML document to produce a
known number of nodes in the final XML.  I believe I am getting some
confusion between the document() items and the items in my pd: XML because
sections like:

	  <xsl:for-each select="pd:stats">
	    <xsl:if test="@index = position()-1">
	      <xsl:value-of select="'true'"/>
	    </xsl:if>
	  </xsl:for-each>


don't seem to be getting accessed at all.

That is, I think when I reference pd:stats, the XLST is thinking I'm
referring to something in document($nodeFileName) rather than something in
my main XML file in the name space pd: 

Can anyone suggest what I'm doing wrong?




<xsl:template match="pd:electrodeStatsList">
<xsl:element name="electrodeStatsList" namespace="urn:probe-design-service">
    <xsl:element name="statsNamesList" namespace="urn:probe-design-service">
	<xsl:for-each select="pd:stats[1]/pd:stat">
	    <xsl:element name="statName"
namespace="urn:probe-design-service">
		<xsl:value-of select="@name" />
	    </xsl:element>
	</xsl:for-each>
    </xsl:element>
<!-- Handle full set of electrode data -->
      <xsl:if test="$useLoop = 'false'">
	  <xsl:for-each select="pd:stats">
	      <xsl:element name="stats"
namespace="urn:probe-design-service">
		  <xsl:for-each select="pd:stat">
		      <xsl:element name="st"
namespace="urn:probe-design-service">
			  <xsl:value-of select="." />
		      </xsl:element>
		  </xsl:for-each>
	      </xsl:element>
	  </xsl:for-each>
    </xsl:if>
<!-- Handle sparse electrode data -->
    <xsl:if test="$useLoop = 'true'">
      <xsl:for-each select="document($nodeFileName)/nodes/n">
	<xsl:variable name="found">
	  <xsl:for-each select="pd:stats">
	    <xsl:if test="@index = position()-1">
	      <xsl:value-of select="'true'"/>
	    </xsl:if>
	  </xsl:for-each>
	</xsl:variable>
	<xsl:choose>
	  <xsl:when test="$found = 'true'">
	    <xsl:for-each select="pd:stats">
	      <xsl:if test="@index = position()-1">
		<xsl:element name="stats"
namespace="urn:probe-design-service">
		    <xsl:for-each select="pd:stat">
			<xsl:element name="st"
namespace="urn:probe-design-service">
			    <xsl:value-of select="." />
			</xsl:element>
		    </xsl:for-each>
		</xsl:element>
	      </xsl:if>
	    </xsl:for-each>
	  </xsl:when>
	  <xsl:otherwise>
	    <xsl:element name="stats" namespace="urn:probe-design-service">
	      <xsl:for-each select="pd:stats[1]/pd:stat">
		<xsl:element name="st" namespace="urn:probe-design-service"
/>
	      </xsl:for-each>
	    </xsl:element>
	  </xsl:otherwise>
	</xsl:choose>
      </xsl:for-each>
    </xsl:if>
</xsl:element>
</xsl:template>




Michael Webster
CombiMatrix Corporation
Software Department
(425) 493-2266

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.