Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: 'namespaceuri()' is an unknown XSLT function

From: Martin Honnen <mahotrash@-----.-->
To: NULL
Date: 1/4/2006 7:56:00 PM

IvarZap wrote:

> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
> xmlns:msxsl="urn:schemas-microsoft-com:xslt" 
> xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-01-04T15:33:26" 
> xmlns:xd="http://schemas.microsoft.com/office/infopath/2003" 
> xmlns:xhtml="http://www.w3.org/1999/xhtml" version="1.0">
>  <xsl:output encoding="UTF-8" method="xml"/>
>  <xsl:template match="text() | 
> *[namespace-uri()='http://www.w3.org/1999/xhtml']" mode="RichText">
>   <xsl:copy-of select="."/>
>  </xsl:template>
>  <xsl:template match="/">
>   <xsl:copy-of select="processing-instruction() | comment()"/>
>   <xsl:choose>
>    <xsl:when test="my:myFields">
>     <xsl:apply-templates select="my:myFields" mode="_0"/>
>    </xsl:when>
>    <xsl:otherwise>
>     <xsl:variable name="var">
>      <xsl:element name="my:myFields"/>
>     </xsl:variable>
>     <xsl:apply-templates select="msxsl:node-set($var)/*" mode="_0"/>
>    </xsl:otherwise>
>   </xsl:choose>
>  </xsl:template>
>  <xsl:template match="my:myFields" mode="_0">
>   <xsl:copy>
>    <xsl:attribute name="my:newAttribute">
>     <xsl:value-of select="@my:newAttribute"/>
>    </xsl:attribute>
>    <xsl:element name="my:richTextField">
>     <xsl:apply-templates select="my:richTextField/text() | 
> my:richTextField/*[namespace-uri()='http://www.w3.org/1999/xhtml']" 
> mode="RichText"/>
>    </xsl:element>
>   </xsl:copy>
>  </xsl:template>
> </xsl:stylesheet>
> -------------------------------------------
> 
> When applied to this .xml file generated with Infopath after filling the 
> form (with no my:newAttribute):
> form2.xml:
> --------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <?mso-infoPathSolution solutionVersion="1.0.0.2" productVersion="11.0.6565" 
> PIVersion="1.0.0.0" 
> href="file:///C:\Documents%20and%20Settings\IvarZapata2\My%20Documents\Desktop\UpgradeInfopath\Template1.xsn" 
> name="urn:schemas-microsoft-com:office:infopath:Template1:-myXSD-2006-01-04T15-33-26" 
> ?><?mso-application progid="InfoPath.Document"?><my:myFields 
> xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2006-01-04T15:33:26" 
> xml:lang="es">
>  <my:richTextField>
>   <div xmlns="http://www.w3.org/1999/xhtml">Rich text content</div>
>   <div xmlns="http://www.w3.org/1999/xhtml"></div>
>  </my:richTextField>
> </my:myFields>

Indeed when I use XslTransform with .NET 1.1 then at runtime during 
executing the Transform method it generates the error
"Unhandled Exception: System.Xml.Xsl.XsltException: 'namespaceuri()' is 
an unknown XSLT function."

When I compile and run with .NET 2.0 (still using XslTransform) no error 
occurs so this seems like you are running into a bug in .NET 1.1 which 
got fixed for 2.0.

When I compile and run with .NET 2.0 using the new XslCompiledTransform 
there is also no problem.

MSXML 3 and 4 also work without problems.

As far as I can see those XPath expressions and XSLT patterns in that 
stylesheet are syntatically correct.


If you change e.g.
   *[namespace-uri()='http://www.w3.org/1999/xhtml']
to e.g.
   xhtml:*
with the xhtml prefix bound to the namespace URI 
http://www.w3.org/1999/xhtml the problem will hopefully vanish but I am 
not sure that is an option for you as you said those stylesheets are 
automatically generated.

-- 

	Martin Honnen --- MVP XML
	http://JavaScript.FAQTs.com/


transparent
Print
Mail
Like It
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.

.
.

transparent

transparent