XSTL and namespaces

  • Thread starter Mariusz Sieraczkiewicz
  • Start date
M

Mariusz Sieraczkiewicz

This is a source (Cocoon's SQLTransformer output):

/////////////////////////////////////////////////////////

<?xml version="1.0" encoding="UTF-8" ?>
<sql xmlns:sql="http://apache.org/cocoon/SQL/2.0">
<rowset xmlns="http://apache.org/cocoon/SQL/2.0">
<row>
<firmyid>100</firmyid>
<nazwafirmy>ghjghjjghjghj</nazwafirmy>
<datautworzenia>2003-06-23</datautworzenia>
<kto_zmienil>29</kto_zmienil>
</row>
</rowset>
</sql>


and xslt stylesheet

/////////////////////////////////////////////////////////

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sql="http://apache.org/cocoon/SQL/2.0">
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -->
<xsl:eek:utput method="xml"/>

<xsl:template match="sql">
<normal>
<xsl:copy-of select="sql:rowset/sql:row/*" />
</normal>
</xsl:template>
</xsl:stylesheet>

/////////////////////////////////////////////////////////

But usingI'm getting very annoying output:

<?xml version="1.0" encoding="UTF-8" ?>
<normal xmlns:sql="http://apache.org/cocoon/SQL/2.0">
<firmyid xmlns="http://apache.org/cocoon/SQL/2.0">100</firmyid>
<nazwafirmy
xmlns="http://apache.org/cocoon/SQL/2.0">oiouioiuui</nazwafirmy>
<datautworzenia
xmlns="http://apache.org/cocoon/SQL/2.0">2003-06-23</datautworzenia>
<kto_zmienil
xmlns="http://apache.org/cocoon/SQL/2.0">29</kto_zmienil>
</normal>

How to change xslt so that there were noin output document - all the elements shouldn't have
any namespace declararion. Something like this:

<?xml version="1.0" encoding="UTF-8" ?>
<normal>
<firmyid>100</firmyid>
<nazwafirmy>oiouioiuui</nazwafirmy>
<datautworzenia>2003-06-23</datautworzenia>
<kto_zmienil>29</kto_zmienil>
</normal>


Regards, Mariusz Sieraczkiewicz
 
M

Martin Honnen

Mariusz said:
This is a source (Cocoon's SQLTransformer output):

/////////////////////////////////////////////////////////

<?xml version="1.0" encoding="UTF-8" ?>
<sql xmlns:sql="http://apache.org/cocoon/SQL/2.0">
<rowset xmlns="http://apache.org/cocoon/SQL/2.0">
<row>
<firmyid>100</firmyid>
<nazwafirmy>ghjghjjghjghj</nazwafirmy>
<datautworzenia>2003-06-23</datautworzenia>
<kto_zmienil>29</kto_zmienil>
</row>
</rowset>
</sql>


and xslt stylesheet

/////////////////////////////////////////////////////////

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sql="http://apache.org/cocoon/SQL/2.0">
<!-- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -->
<xsl:eek:utput method="xml"/>

<xsl:template match="sql">
<normal>
<xsl:copy-of select="sql:rowset/sql:row/*" />
</normal>
</xsl:template>
</xsl:stylesheet>

/////////////////////////////////////////////////////////

But using

I'm getting very annoying output:

<?xml version="1.0" encoding="UTF-8" ?>
<normal xmlns:sql="http://apache.org/cocoon/SQL/2.0">
<firmyid xmlns="http://apache.org/cocoon/SQL/2.0">100</firmyid>
<nazwafirmy
xmlns="http://apache.org/cocoon/SQL/2.0">oiouioiuui</nazwafirmy>
<datautworzenia
xmlns="http://apache.org/cocoon/SQL/2.0">2003-06-23</datautworzenia>
<kto_zmienil
xmlns="http://apache.org/cocoon/SQL/2.0">29</kto_zmienil>
</normal>

How to change xslt so that there were no

in output document - all the elements shouldn't have
any namespace declararion. Something like this:

<?xml version="1.0" encoding="UTF-8" ?>
<normal>
<firmyid>100</firmyid>
<nazwafirmy>oiouioiuui</nazwafirmy>
<datautworzenia>2003-06-23</datautworzenia>
<kto_zmienil>29</kto_zmienil>
</normal>

Use
<xsl:stylesheet exclude-result-prefixes="sql"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,792
Messages
2,569,639
Members
45,351
Latest member
RoxiePulli

Latest Threads

Top