[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
Hi,
I have this input and i want to split it into multiple files, one per each "table" element
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:
What am i doing wrong ? Anyway to avoid this ?
Pablo
[xsl] namespace declaration problem creating new xml file
Subject: [xsl] namespace declaration problem creating new xml file From: Pablo Sebastian Rodriguez <psrodriguez@xxxxxxxxxxxxxxxx> Date: Thu, 28 Aug 2008 18:13:19 -0300 |
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 |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] use-when in the xsl:inlcu, Michael Kay | Thread | Re: [xsl] namespace declaration pro, Colin Paul Adams |
Re: [xsl] Tennison-tests Sourceforg, Florent Georges | Date | Re: [xsl] namespace declaration pro, Colin Paul Adams |
Month |