On 03/11/2011 02:15 PM, Philippe Nobili wrote:
>  On 03/11/2011 01:14 PM, Hussein Shafie wrote:
>>
>> * It's:
>>
>> <cfg:command name="pick"
>> parameter="'Choose the default Attribute' true %_" />
>>
>> and not:
>>
>> <cfg:command name="pick"
>> parameter="'Choose the default Attribute' false %_" />
> Yes, we used it with the appropriate 'true' flag (it was a typo in my mail)
>> * Adding trace="true" to the macro would print useful diagnostics on the
>> console.
>>
> Thanks; I am really confused...
> Indeed XXE complains that namespace prefix '*geov*' is undefined (3
> compilation errors in the stylesheet):
> 
> /-->setDefaultItem:transform: checking...
>    transform "%_": error: Namespace prefix geov has not been declared
>    transform "%_": error: Namespace prefix geov has not been declared
>    transform "%_": error: Namespace prefix geov has not been declared
>    cannot compile
> ---
> /And indeed, when its prints the stylesheet on the terminal, there is
> only one prefix printed, i.e. xmlns:xsl
> 
> /<?xml version="1.0"?>
> <xsl:stylesheet
> version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>>/
> 
> However, in my *transform command*, the stylesheet does define two
> prefixes, '*xsl*' and '*geov*'; it behaves as if only '*xsl*' had been
> defined:
>  
> <cfg:command name="setDefaultItem">
>     <cfg:macro trace="true">
>       <cfg:sequence>
>            <cfg:get expression="serialize($implicitElement)"/>
> /           <cfg:transform source="%_">
>                 <xsl:stylesheet version="1.0"
>                                         
> xmlns:geov="http://www.cggveritas.com/geovation/module/2.0";
>                                         
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> /
> Surely some obvious tiny thing that I fail to see... ?

No, it's just a bug in XXE, which will be fixed in next release.

The rather ugly workaround is to add to the stylesheet a foreign element
in the "geovation/module/2.0" namespace using the "geov" prefix.

Example:
---
    <cfg:transform source="%_">
      <xsl:stylesheet version="1.0"
        xmlns:geov="http://www.cggveritas.com/geovation/module/2.0";
        xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

        <geov:ignored />

        <xsl:template match="/geov:menu">
          <xsl:for-each select="geov:item">
              <xsl:value-of
select="concat(concat(geov:nativeDescript/@name,' '),@id)"/>
              <xsl:if test="not(position() = last())">
                 <xsl:text> </xsl:text>
              </xsl:if>
           </xsl:for-each>
        </xsl:template>

      </xsl:stylesheet>
    </cfg:transform>
---

This kind of foreign elements is allowed by the XSLT 1 standard. See
http://www.w3.org/TR/xslt#stylesheet-element
---
In addition, the xsl:stylesheet element may contain any element not from
the XSLT namespace, provided that the expanded-name of the element has a
non-null namespace URI. The presence of such top-level elements must not
change the behavior of XSLT elements and functions defined in this document
---



 
--
XMLmind XML Editor Support List
[email protected]
http://www.xmlmind.com/mailman/listinfo/xmleditor-support

Reply via email to