Skip to Main Content

DevOps, CI/CD and Automation

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!

How to indent using XSLT??

398398Nov 13 2003 — edited Nov 18 2003
Hi All,

I am facing the following problem:

I have a xsql file which exracts the data from a Oracle table, that works fine..

--- xsql file is: ----

<?xml version = "1.0" encoding= "UTF-8"?>
<?xml-stylesheet type="text/xsl" href="p3.xsl"?>
<xsql:query connection="Connection1" id-attribute="" tag-case="lower"
rowset-element="LIST" row-element="DEPA"
xmlns:xsql="urn:oracle-xsql">

SELECT * from onixt2

</xsql:query>

Then I have the 'p3.xsl' file which I have used to format the outcome, it too works fine BUT WITHOUT INDENTING THEY WAY I HAVE GIVEN IN THE xsl FILE. ( I want to have the output indented as the way I have given the Tags )

--- xsl file is: ---

<xsl:stylesheet version="1.0" encoding="UTF-8" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method ="xml" indent= "yes" encoding="UTF-8"/>
<xsl:template match ="list">
<ONIXMessage>
<Header>
<FromCompany> Beta Publishers </FromCompany>
<SentDate>20031112</SentDate>
</Header>
<xsl:for-each select="depa">
<Product>
<RecordReference>
<xsl:value-of select="a001"/>
</RecordReference>
<NotificationType>
<xsl:value-of select="a002"/>
</NotificationType>
</Product>
</xsl:for-each>
</ONIXMessage>
</xsl:template>
</xsl:stylesheet>

--- OUTPUT comes as:

<?xml version="1.0" encoding="UTF-8" ?>
- <ONIXMessage>
- <Header>
<FromCompany>Beta Publishers </FromCompany>
<SentDate>20031112</SentDate>
</Header>
- <Product>
<RecordReference>UKG: ACADEMIC</RecordReference>
<NotificationType>340</NotificationType>
</Product>
</ONIXMessage>

---
I want have the OUTPUT as FOLLOWS:

<?xml version="1.0" encoding="UTF-8" ?>
- <ONIXMessage>
- <Header>
###<FromCompany>Beta Publishers </FromCompany>
######<SentDate>20031112</SentDate>
</Header>
- #####<Product>
######<RecordReference>UKG: ACADEMIC</RecordReference>
##########<NotificationType>340</NotificationType>
#####</Product>
</ONIXMessage>


# is NOT SOMETHING TO PRINT WITH THE OUTPUT,, I HAVE USED TO TELL ALL YOU THOSE ARE THE WHITESPACES REQUIRED WITH THE OUTPUT... is to denote white spaces,,,
Can someone help me to resolve this please??
Thanks in Advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 16 2003
Added on Nov 13 2003
1 comment
575 views