xsl-list
[Top] [All Lists]

RE: using node-set on a query result

2004-09-12 04:59:06
Your stylesheet is correctly displaying the string-value of the <Text/>
element. The string value of the <Text/> element is the concatenation of all
its descendant text nodes. Since there are no descendant text nodes, the
string-value is the empty string, "". Perhaps you meant <xsl:copy-of>
instead of <xsl:value-of>?

Michael Kay 

-----Original Message-----
From: Leona Slepetis [mailto:LSlepetis(_at_)alliancetech(_dot_)com] 
Sent: 12 September 2004 04:47
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] using node-set on a query result







Hi All,

I'm trying to build a tree to be used in other places in my 
stylesheet.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:transform
 xmlns:xsl=" http://www.w3.org/1999/XSL/Transform " version="1.0"
 xmlns:esql=" http://apache.org/cocoon/SQL/v2 "
 xmlns:exsl=" http://exslt.org/common "
                 extension-element-prefixes="exsl">
<xsl:variable name="qinfo">
  <Question>
    <esql:connection>
      <esql:autocommit>false</esql:autocommit>
      <esql:pool>MYDB</esql:pool>
      <esql:execute-query>
        <esql:query>
          select text from question where order = 1
        </esql:query>
        <esql:results>
          <esql:row-results>
            <Text><esql:get-string column="text" /></Text>
          </esql:row-results>
        </esql:results>
      </esql:execute-query>
    </esql:connection>
  </Question>
</xsl:variable>
<xsl:template match="buildsomething">
  ...
  <td>XXXXX<xsl:value-of select="exsl:node-set($qinfo)"/>XXXXX<td>
  <td>YYYYY<xsl:value-of 
select="exsl:node-set($qinfo)//Text"/>YYYYY<td>
  ...
</xsl:template>
</xsl:transform>

This is the result of "buildsomething":

<td>XXXXXfalseSURVEY
          select text from sur_question where order = 1
        XXXXX</td><td>YYYYYYYYYY</td>

Why am I not able to get the value of the Text node here? Am I doing
something wrong with node-set(), or is there a better way to do this
altogether (within the same stylesheet)? My actual query is 
more complex
than the simplified version I show above.

 Many thanks,
Leona


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--





<Prev in Thread] Current Thread [Next in Thread>