Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Cannot get to print NEWLINE in XMLTransform using XSLT

353545May 2 2007 — edited May 2 2007
I am trying to parse an XML tree and print out the contents as free-text. While doing so, I am unable to print the NEWLINE character. What I need the output is like this:

DESIRED OUTPUT:

Jamestown
2007-03-28
523736560
2007-03-29
WED

However, I am getting the current output as this:

CURRENT OUTPUT:

Jamestown2007-03-285237365602007-03-29WED

(All the elements are printed in one-line, even though I am trying to explicitly output newline character.)

Here is the script:

-- SCRIPT:


DECLARE
-- Local variables here
v_XML XMLType := XMLType('<offers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="xsd.xsd">
<submit type="DAM" date="2007-03-28" name="MKTPART1" mode="NORMAL"/>
<offer name="Jamestown" flag="true" version_no="1.0">
<standing date="2007-03-29" type="WED"/>
<identifier external_id="523736560"/>
</offer>
</offers>');
v_XSLT XMLType := XMLType('<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:value-of select="/offers/offer/@name"/><xsl:text>
</xsl:text>
<xsl:value-of select="/offers/submit/@date"/><xsl:text>
</xsl:text>
<xsl:value-of select="/offers/offer/standing/@date"/><xsl:text>
</xsl:text>
<xsl:value-of select="/offers/offer/standing/@type"/><xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>');
BEGIN
-- Test statements here
DBMS_OUTPUT.PUT_LINE(XMLType.transform(v_XML, v_XSLT).getStringVal());

END;
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 30 2007
Added on May 2 2007
8 comments
3,911 views