Just tried on sample xml, though cannot understand why it is not working
on
<chapter version="5.2" xml:lang="en" docsubtype="chp" id="c0030"
xmlns:sb="http://www.elsevier.com/xml/bk/dtd" xmlns:ce="
http://www.elsevier.com/xml/common/dtd"><ce:title>xxxxx</ce:title>
Too many namespaces declarations :---(( . dunno. I will appreciate if any
body can help.
.........................
Input
<?xml version="1.0" encoding="UTF-8"?>
<!-- New document created with EditiX at Fri Aug 06 11:20:17 IST 2010 -->
<?xml-stylesheet type="text/xsl" href="section.xsl"?>
<chapter xmlns:ce=" http://www.elsevier.com/xml/common/dtd">
<ce:title>XXXXXX</ce:title>
<ce:section>
<ce:section-title>This is section title</ce:section-title>
<ce:section>
<ce:section-title>This is section title continue</ce:section-title>
<ce:para>This is para 1.</ce:para>
</ce:section>
</ce:section>
<ce:section>
<ce:section-title>This is section title</ce:section-title>
<ce:para>This is para 2.</ce:para>
<ce:section>
<ce:section-title>This is section title regular</ce:section-title>
<ce:para>This is para 3.</ce:para>
</ce:section>
</ce:section>
</chapter>
Stylesheet
<?xml version="1.0" encoding="UTF-8" ?>
<!-- New document created with EditiX at Fri Aug 06 11:23:38 IST 2010 -->
<xsl:stylesheet version="1.0" xmlns:aid="
http://ns.adobe.com/AdobeInDesign/4.0/" xmlns:aid5="
http://ns.adobe.com/AdobeInDesign/5.0/" xmlns:ce="
http://www.elsevier.com/xml/common/dtd" xmlns:xsl="
http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes"/>
<!-- first template copies input to output -->
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="chapter">
<xsl:copy>
<xsl:attribute name="aid:pstyle"/>
<xsl:attribute name="aid5:tablestyle"/>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="chapter/ce:title">
<xsl:element name="ce:title">
<xsl:attribute name="aid:pstyle">Chap title</xsl:attribute>
<xsl:copy-of select="@*"/>
</xsl:element>
</xsl:template>
<xsl:template match="chapter/ce:section/ce:section/ce:section-title">
<xsl:copy>
<xsl:choose>
<xsl:when
test="name(parent::ce:section/preceding-sibling::*[1])='ce:section-title'">
<xsl:attribute name="aid:pstyle">H2_continue</xsl:attribute>
</xsl:when>
<xsl:when
test="name(parent::ce:section/preceding-sibling::*[1])='ce:para'">
<xsl:attribute name="aid:pstyle">H2</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="aid:pstyle">H2</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
result : perfect
<?xml version="1.0"?>
<!-- New document created with EditiX at Fri Aug 06 11:20:17 IST 2010 -->
<?xml-stylesheet type="text/xsl" href="section.xsl"?><chapter xmlns:ce="
http://www.elsevier.com/xml/common/dtd" xmlns:aid="
http://ns.adobe.com/AdobeInDesign/4.0/" xmlns:aid5="
http://ns.adobe.com/AdobeInDesign/5.0/" aid:pstyle="" aid5:tablestyle="">
<ce:title aid:pstyle="Chap title"/>
<ce:section>
<ce:section-title>This is section title</ce:section-title>
<ce:section>
<ce:section-title aid:pstyle="H2_continue">This is section title
continue</ce:section-title>
<ce:para>This is para 1.</ce:para>
</ce:section>
</ce:section>
<ce:section>
<ce:section-title>This is section title</ce:section-title>
<ce:para>This is para 2.</ce:para>
<ce:section>
<ce:section-title aid:pstyle="H2">This is section title
regular</ce:section-title>
<ce:para>This is para 3.</ce:para>
</ce:section>
</ce:section>
</chapter>
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--