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

combining two variables to generate XPATH

Subject: combining two variables to generate XPATH
From: "bix xslt" <bix_xslt@xxxxxxxxxxx>
Date: Tue, 17 Dec 2002 19:11:30 +0000
combining two variables
All,

I have the following XML and XSLT, and I am having difficulty with the template that is labeled 'dispItem'. Specifically, I have commented out the portion that provides the error (see the for-each with the $branch variable). I want to take two variables as inputs and then combine them into a single XPATH and iterate over that XPATH. Unfortunately, I am getting a 'this is not a DOM' error. What can I do to fix this? Thanks in advance!

Bix

-------------- XML --------------


<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE list SYSTEM "sort.dtd"> <?xml-stylesheet type="text/xsl" href="sort_1.xsl"?>

<list mode="normal">
  <proc id="a" />
  <proc id="h" />
  <proc type="r" id="b">
      <exec type="a">
          <item idr="c" />
          <item idr="d" />
      </exec>
  </proc>

  <proc type="e" id="c">
      <dpnd>
          <item idr="a" />
          <item idr="h" />
      </dpnd>
      <exec type="a">
          <item idr="e" />
          <item idr="f" />
      </exec>
  </proc>
  <proc id="d">
      <dpnd>
          <item idr="g" />
      </dpnd>
  </proc>
  <proc id="e" />
  <proc id="f" />

  <proc id="g" />
</list>


-------------- XSLT --------------



<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:key name="idRef" match="proc" use="@id" />


   <xsl:template match="proc" name="depn">
       <xsl:param name="node" select="." />

       <xsl:value-of select="$node/@id" />
       <xsl:if test="$node/dpnd">
           <xsl:text> (</xsl:text>
           <xsl:call-template name="dispItem">
               <xsl:with-param name="node" select="$node"/>
               <xsl:with-param name="type" select="dpnd"/>
           </xsl:call-template>
           <xsl:text>)</xsl:text>
       </xsl:if>
       <xsl:if test="$node/exec">
           <xsl:text> "</xsl:text>
           <xsl:call-template name="dispItem">
               <xsl:with-param name="node" select="$node"/>
               <xsl:with-param name="type" select="exec"/>
           </xsl:call-template>
           <xsl:text>"</xsl:text>
       </xsl:if>
       <br />
   </xsl:template>

<xsl:template name="dispItem">
<xsl:param name="node" />
<xsl:param name="type" select="dpnd" />
<xsl:value-of select="$node/@id" />
<xsl:value-of select="$type/@idr" />
<xsl:variable name="branch" select="concat($node,'/',$type,'/item')" />
<xsl:value-of select="$branch" />
<!-- <xsl:for-each select="$node">
<xsl:value-of select="@idr" />
<xsl:if test="following-sibling::*"><xsl:text>, </xsl:text></xsl:if>
</xsl:for-each> -->
</xsl:template>
</xsl:stylesheet>





_________________________________________________________________
The new MSN 8: advanced junk mail protection and 2 months FREE* http://join.msn.com/?page=features/junkmail



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



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.