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

namespace declaration problem creating new xml file

Subject: namespace declaration problem creating new xml file
From: Pablo Sebastian Rodriguez <psrodriguez@xxxxxxxxxxxxxxxx>
Date: Thu, 28 Aug 2008 18:13:19 -0300
 namespace declaration problem creating new xml file
Hi,
I have this input and i want to split it into multiple files, one per each "table" element


<?xml version="1.0" encoding="ISO-8859-1"?>
<schema version="0.3">
   <table name="gacl_aco_map">
       <field name="acl_id" type="I" size="11">
           <KEY/>
           <DEFAULT value="0"/>
       </field>
       <field name="section_value" type="C" size="230">
           <KEY/>
           <DEFAULT value="0"/>
       </field>
       <field name="value" type="C" size="230">
           <KEY/>
       </field>
   </table>
   <table name="gacl_groups_aro_map">
       <field name="group_id" type="I" size="11">
           <NOTNULL/>
           <DEFAULT value="0"/>
       </field>
       <field name="aro_id" type="I" size="11">
           <NOTNULL/>
           <DEFAULT value="0"/>
       </field>
       <index name="gacl_aro_id">
           <col>aro_id</col>
       </index>
       <index name="group_id">
           <col>group_id</col>
       </index>
   </table>
</schema>

This is what i'm doing:

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fn="http://www.w3.org/2005/04/xpath-functions">


<xsl:output method="xml" version="1.0" encoding="ISO-8859-1" indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="table">
<xsl:variable name="file" select="concat( '/var/www/tables/', @name, '.xml' )"/>
<xsl:result-document method="xml" encoding="ISO-8859-1" href="{$file}">
<schema version="0.3">
<xsl:copy-of select="."/>
</schema>
</xsl:result-document>
</xsl:template>
</xsl:stylesheet>


The problem is that the namespace declaration ( "xmlns:fn..." ) gets added inside the root element of every file created, like this:

<?xml version="1.0" encoding="ISO-8859-1"?>
<schema xmlns:fn="http://www.w3.org/2005/04/xpath-functions"
       version="0.3">
   <table name="gacl_aco_map">
       <field name="acl_id" type="I" size="11">
           <KEY/>
           <DEFAULT value="0"/>
       </field>
       <field name="section_value" type="C" size="230">
           <KEY/>
           <DEFAULT value="0"/>
       </field>
       <field name="value" type="C" size="230">
           <KEY/>
       </field>
   </table>
</schema>

What am i doing wrong ? Anyway to avoid this ?

Pablo

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-2007 All Rights Reserved.