Altova Mailing List Archives


RE: [xsl] namespace declaration problem creating new xml file

From: "Michael Kay" <mike@------------>
To:
Date: 8/28/2008 9:52:00 PM
Just get rid of the fn declaration from your stylesheet. (a) you're not
using it, (b) you never need to use it in XSLT, and (c) it's the wrong
namespace URI anyway. I suspect you are using some XSLT editor that adds it
automatically - write to your vendor and ask them to change this irritating
habit.

Alternatively, if you were using this namespace in your stylesheet, you
could prevent it being added to the result document using
exclude-result-prefixes="fn".

Michael Kay
http://www.saxonica.com/ 

> -----Original Message-----
> From: Pablo Sebastian Rodriguez [mailto:psrodriguez@xxxxxxxxxxxxxxxx] 
> Sent: 28 August 2008 22:13
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: [xsl] 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

Disclaimer

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.