I want para's as list format sublist also is in para format as list format
My Input XML File:
<?xml version="1.0" encoding="UTF-8"?>
<chapter>
<title>Base Food</title>
<subsection>
<title>Nothing</title>
<body>
<p> (a)<tab/>1Y The Act also states that the may undertake a review of the definition of the term.</p>
<p> (b)<tab/>The Act also states that the may undertake a review of the definition of the term:</p>
<p> (i)<tab/>Act also states that the may undertake a review of the definition of the term.</p>
<p> (ii)<tab/>States that the may undertake a review of the definition of the term.</p>
</body>
</subsection>
</chapter>
My XSLT Coding is
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" omit-xml-declaration="no"></xsl:output>
<xsl:template match="/">
<xsl:apply-templates></xsl:apply-templates>
</xsl:template>
<xsl:template match="chapter">
<chapter>
<xsl:apply-templates/>
</chapter>
</xsl:template>
<xsl:template match="subsection">
<section>
<xsl:apply-templates/>
</section>
</xsl:template>
<xsl:template match="p">
<para>
<xsl:apply-templates/>
</para>
</xsl:template>
<xsl:template match="title">
<title>
<xsl:apply-templates/>
</title>
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>
I am getting output as
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<chapter>
<title>Base Food</title>
<section>
<title>Nothing</title>
<para> (a)<tab/>1Y The Act also states that the may undertake a review of the definition of the term.</para>
<para> (b)<tab/>The Act also states that the may undertake a review of the definition of the term:</para>
<para> (i)<tab/>Act also states that the may undertake a review of the definition of the term.</para>
<para> (ii)<tab/>States that the may undertake a review of the definition of the term.</para>
</section>
</chapter>
but i want output tab tag before text as item attribute
output needed as
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<chapter>
<title>Base Food</title>
<section level="sect1" num="I" number-type="manual">
<title>Nothing</title>
<orderedlist type="manual">
<item num="(a)"><para>1Y The Act also states that the may undertake a review of the definition of the term.</para></item>
<item num="(b)"><para>The Act also states that the may undertake a review of the definition of the term:</para>
<orderedlist type="manual">
<item num="(i)"><para>Act also states that the may undertake a review of the definition of the term.</para></item>
<item num="(ii)"><para>States that the may undertake a review of the definition of the term.</para></item></orderedlist></item></orderedlist>
</section>
</chapter>
Please assist me.
Thanks in Advance
Here is an attempt to write a template matching
body
to usefor-each-group group-adjacent
to identify adjacentp
elements first and then to use a recursive function to find nested list usingfor-each-group group-starting-with
:I have written that as XSLT 3.0 as supported by Saxon 9.8 but you should be able to incorporate all but the
<xsl:mode on-no-match="shallow-copy"/>
into your XSLT 2.0 stylesheet with your other templates doing the transformation you already have.