Dear All,
We want to use the HTML paragraph attribute based on the xml attribute from the element <rx.p>
XML:
<rx.p justify="full" left-indent="2" first-indent="1"><rx.text>In the event either (a) no such appeal is made by the Purchaser within fourteen (14) working days from the date of receipt by the Purchaser.</rx.text></rx.p>
We're using the below xslt using SAXAN and XSLT2.0 (Oxygen Editor):
XSLT:
Code:
<xsl:template match="rx.p">
<xsl:variable name="Findent"><xsl:value-of select="@first-indent"/></xsl:variable>
<xsl:variable name="Lindent"><xsl:value-of select="@left-indent"/></xsl:variable>
<xsl:choose>
<xsl:when test="@justify='full'">
<p align="justify">
<xsl:if test="$Findent = '1'">
<xsl:attribute name="style">text-indent:.3in;</xsl:attribute>
</xsl:if>
<xsl:if test="$Lindent = '1'">
<xsl:attribute name="style">margin-left:.3in;</xsl:attribute>
</xsl:if>
<xsl:if test="$Findent = '1.5'">
<xsl:attribute name="style">text-indent:.4.5in;</xsl:attribute>
</xsl:if>
<xsl:if test="$Lindent = '1.5'">
<xsl:attribute name="style">margin-left:.4.5in;</xsl:attribute>
</xsl:if>
<xsl:if test="$Findent = '2'">
<xsl:attribute name="style">text-indent:.6in;</xsl:attribute>
</xsl:if>
<xsl:if test="$Lindent = '2'">
<xsl:attribute name="style">margin-left:.6in;</xsl:attribute>
</xsl:if>
<xsl:if test="$Findent = '2.5'">
<xsl:attribute name="style">text-indent:.7.5in;</xsl:attribute>
</xsl:if>
<xsl:if test="$Lindent = '2.5'">
<xsl:attribute name="style">margin-left:.7.5in;</xsl:attribute>
</xsl:if>
<xsl:if test="$Findent = '3'">
<xsl:attribute name="style">text-indent:.9in;</xsl:attribute>
</xsl:if>
<xsl:if test="$Lindent = '3'">
<xsl:attribute name="style">margin-left:.9in;</xsl:attribute>
</xsl:if>
<xsl:apply-templates/>
</p>
</xsl:when>
</xsl:choose>
Using above XSLT the output HTML:
<p align="justify" style="margin-left:.6in;">In the event either (a) no such appeal is made by the Purchaser within fourteen (14) working days from the date of receipt by the Purchaser.</p>
The problem in the above HTML is only the attribute "margin-left" is there but not "text-indent". Since we're new to this Transformation please guide us to modify the above code and generates the HTML as below.
Required HTML:
<p align="justify" style="margin-left:.6in; text-indent:.3in">In the event either (a) no such appeal is made by the Purchaser within fourteen (14) working days from the date of receipt by the Purchaser.</p>
Can someone please help...