[xslt] Fwd: [xsl] Re: namespace change, what am I missing here?



Note: I'm one release behind on libxml (2.5.6 is installed) but using 
1.0.30 of libxslt. So, this maybe is fixed already. I sent a message to 
fink to ask for the latest libxml, so hopefully I will be able to test 
it with that in a few days.

simon

Begin forwarded message:

> From: "Dimitre Novatchev" <dnovatchev@yahoo.com>
> Date: Sun Jun 29, 2003  4:10:09  AM America/Montreal
> To: xsl-list@lists.mulberrytech.com
> Subject: [xsl] Re: namespace change, what am I missing here?
> Reply-To: xsl-list@lists.mulberrytech.com
>
> This is probably a bug.
>
> With MSXML3, MSXML4, Saxon 6.5.2, Xalan C 1.5, .Net xslTransform (nXSLT
> command-line utility), JD, and 4XSLT I get this correct result:
>
>
>
> <?xml version="1.0" encoding="utf-8"?>
> <rss xmlns="foo" version="2.0">
>   <channel>
>     <title>Werblog</title>
>     <link>http://werbach.com/blog/</link>
>   </channel>
> </rss>
>
>
> =====
> Cheers,
>
> Dimitre Novatchev.
> http://fxsl.sourceforge.net/ -- the home of FXSL
>
>
>
> "S Woodside" <sbwoodside@yahoo.com> wrote in message
> news:CA9A6736-AA01-11D7-A93E-000393414368@yahoo.com...
>> Hi,
>>
>> I've got a stylesheet renamespace.xsl, that is intended to take an
>> arbitrary XML file and change the namespace (no matter what it is) 
>> into
>> an arbitrary new namespace. It's based on the FAQ. Both the location 
>> of
>> the file and the new namespace are parameters. But when I run it
>> through my script (it's all below) I get the namespace applied to all
>> the child nodes but NOT the root node. Why not??
>>
>> Here's what I did:
>>
>> %%%%%%%% xsltproc -V
>> Using libxml 20506, libxslt 10030 and libexslt 720
>> xsltproc was compiled against libxml 20506, libxslt 10030 and libexslt
>> 720
>> libxslt 10030 was compiled against libxml 20506
>> libexslt 720 was compiled against libxml 20506
>>
>> %%%%%%%% cat renamespace.xsl
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xsl:stylesheet version="1.0"
>>                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>>>
>>
>>    <xsl:param name="location"/>
>>    <xsl:param name="new_namespace"/>
>>
>>    <xsl:template match="/">
>>      <xsl:message>re_namespace'ing</xsl:message>
>>      <!--<wrapper>-->
>>        <xsl:choose>
>>          <xsl:when test="$location != ''">
>>            <xsl:apply-templates select="document($location)/node()"
>> mode="renamespace"/>
>>          </xsl:when>
>>          <xsl:otherwise>
>>            <xsl:apply-templates mode="renamespace"/>
>>          </xsl:otherwise>
>>        </xsl:choose>
>>      <!--</wrapper>-->
>>    </xsl:template>
>>
>>    <xsl:template match="*" mode="renamespace">
>>      <xsl:element
>>          name="{local-name()}"
>>          namespace="{$new_namespace}">
>>        <xsl:copy-of select="@*"/>
>>        <xsl:apply-templates mode="renamespace"/>
>>      </xsl:element>
>>    </xsl:template>
>>
>> </xsl:stylesheet>
>>
>> %%%%%%%% cat test.orig.xml
>> <?xml version="1.0"?>
>> <rss version="2.0">
>>          <channel>
>>                  <title>Werblog</title>
>>                  <link>http://werbach.com/blog/</link>
>>
>>          </channel>
>> </rss>
>>
>> %%%%%%%% xsltproc --stringparam "new_namespace" "foo" \
>>   renamespace.xsl test.orig.xml
>> <?xml version="1.0"?>
>> <rss xmlns:ns2="foo" version="2.0">
>>          <ns2:channel>
>>                  <ns2:title>Werblog</ns2:title>
>>                  <ns2:link>http://werbach.com/blog/</ns2:link>
>>
>>          </ns2:channel>
>> </rss>
>>
>>
>> ****
>>
>> I would expect to get this:
>>
>> <?xml version="1.0"?>
>> <ns2:rss xmlns:ns2="foo" version="2.0">
>>          <ns2:channel>
>>                  <ns2:title>Werblog</ns2:title>
>>                  <ns2:link>http://werbach.com/blog/</ns2:link>
>>
>>          </ns2:channel>
>> </rss>
>>
>>
>> (i'm also not sure where the "ns2" is from but that doesn't matter to
>> me.)
>>
>> simon
>>
>> --
>> www.simonwoodside.com -- 99% Devil, 1% Angel
>>
>>
>>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>>
>>
>
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>
>

--
      anti-spam: do not post this address publicly
www.simonwoodside.com -- 99% Devil, 1% Angel




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]