[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Cannot include namespaces [XSLT 1.0] xsltproc

Subject: Re: Cannot include namespaces [XSLT 1.0] xsltproc
From: pankaj.c@xxxxxxxxxxxxxxxxxx
Date: Mon, 23 Aug 2010 20:33:43 +0530
Re:  Cannot include namespaces [XSLT 1.0] xsltproc
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>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.