Folks:
I am trying to transform an XML Datagram into ordinary text. I am using XMLType.transform to achieve this. However, my problem is with the output not being generated with NEWLINE -- chr(10) -- character. So, while I need this output:
Desired Output:
Jamestown
2007-03-28
523736560
2007-03-29
WED
I am getting this:
Current Output:
Jamestown2007-03-285237365602007-03-29WED
Here is the script:
Script:
-- Created on 5/2/2007 by RARUL
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/identifier/@external_id"/><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;