On 7/28/12 3:16 AM, raktimb wrote:
>
> Hello everyone,
>
> I have a JDBC driver, where from I am querying the database and storing
> the value in a local veriable. The quary returns values of a single
> field for all the rows. The value in that variable is a continus string,
> without any separation. Is there any way to arrange those values comma
> separatedly in a string from XSLT? Here is my Template:
>
>
> Code:
> --------------------
> <xsl:template match="trigger[@source='QueryBUJob']" xmlns:jdbc="urn:dirxml:jdbc">
> <xsl:message>
> <status level="success" type="add-user-operation XSLT">
> <xsl:text>Get BU names from T_WF_BU</xsl:text>
> </status>
> </xsl:message>
> <xsl:variable name="query">
> <jdbc:statement>
> <xsl:copy-of select="association"/>
> <jdbc:sql>
> <xsl:text>SELECT UNIT_NAME FROM T_WF_BU</xsl:text>
> </jdbc:sql>
> </jdbc:statement>
> </xsl:variable>
> <xsl:variable name="result" select="query:query($destQueryProcessor,$query)"/>
> <jdbc:statement>
> <operation-data>
> <xsl:element name="BUQuery">
> <xsl:value-of select="$result"/>
> </xsl:element>
> </operation-data>
> </jdbc:statement>
> </xsl:template>
> --------------------
>
>
>
> And this is the output:
>
>
> Code:
> --------------------
> <output>
> <status event-id="0" level="success">
> <operation-data>
> <BUQuery>DirXML Driver for JDBCNovell, Inc.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXX</BUQuery>
> </operation-data>
> </status>
> </output>
>
> --------------------
>
>


What query:query returns is a nodeset containing the XML result of the
query. If you try to treat that as if it were a string (i.e.
xsl:value-of) all you will get is the concatenated textual content
without any of the markup, which is almost never what you want. In order
to get the data out of it that you need you'll have to use XPath/XSLT to
iterate that elements that are interesting to you.

--
Shon