0

Hi,

As the title states, I have a query that I use to concatenate all the rows into a single string and I use the XMLTransform method to accomplish that but I still need to add a new line separator within the XML string and so far I didn't find any escape character to work. I tried the '\n', CHR(10), ASCII_CHR(10)||ASCII_CHR(13), <br/> ...

Here is the code snippet:

SELECT
        XMLTransform(SYS_XMLAgg(SYS_XMLGen(LocationTable.LOCATION)), XMLType('<?xml version="1.0"?><xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
          <xsl:template match="/">
            <xsl:for-each select="/ROWSET/LOCATION">
              <xsl:value-of select="text()"/>
              ---NEW LINE SEPARATOR NEEDED HERE---
            </xsl:for-each>
          </xsl:template>
        </xsl:stylesheet>')).getstringval()
        FROM LocationTable

Regards,
Alin

1
Contributor
1
Reply
2
Views
6 Years
Discussion Span
Last Post by end3r
0

I found the answer:

SELECT
        XMLTransform(SYS_XMLAgg(SYS_XMLGen(LocationTable.LOCATION)), XMLType('<?xml version="1.0"?><xsl:stylesheet version="1.0"
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
          <xsl:variable name="new_line" select="''&#xA;''" />
          <xsl:template match="/">
            <xsl:for-each select="/ROWSET/LOCATION">
              <xsl:value-of select="text()"/>
              <xsl:value-of select="$new_line" />
            </xsl:for-each>
          </xsl:template>
        </xsl:stylesheet>')).getstringval()
        FROM LocationTable
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.