[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

RE: [xsl] using node-set on a query result


Subject: RE: [xsl] using node-set on a query result
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Sun, 12 Sep 2004 12:59:06 +0100

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@xxxxxxxxxxxxxxxx] 
> Sent: 12 September 2004 04:47
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> 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


Current Thread