Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 12th, 2013, 07:51 AM
Authorized User
Join Date: Apr 2008
Posts: 85
Thanks: 10
Thanked 0 Times in 0 Posts
Default Problem with XSLT in vb.net

Hi All,

I have written XSlT below:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:exsl="http://exslt.org/common" extension-element-prefixes="exsl">

<xsl:template match="/">

<xsl:variable name="parent">
<xsl:call-template name="parent">
<xsl:with-param name="parentid" select="//ID"/>

<xsl:value-of select="$parent"/></xsl:template>

<xsl:template name="parent">
<xsl:param name="parentid"/>
<xsl:when test="count(exsl:node-set($parentid)//objectid/node()|@*) > 1">
<xsl:value-of select="exsl:node-set($parentid)//objectid[count(exsl:node-set($parentid)//objectid/node()|@*) - 1]/text()"/></xsl:when>
<xsl:value-of select="exsl:node-set($parentid)//objectid[1]/text()"/></xsl:otherwise>
When I am running this in vb.net application, I m getting the error below:

Exception: {0}System.Runtime.InteropServices.COMException (0x80004005): Namespace 'http://exslt.org/common' does not contain any functions.

Could someone please tell me where I am doing wrong.

Old March 12th, 2013, 08:09 AM
Friend of Wrox
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts

Well you are trying to use an extension function and not all extensions are supported by all XSLT processors. The .NET (2.0 and later) XslCompiledTransform is known to support exsl: node-set, other Microsoft XSLT processors don't support that function. So if you are using VB.NET make sure you use System.Xml.Xsl.XslCompiledTransform and not XslTransform or as the COMException suggests, a version of MSXML via COM interop. If you really want to use XslTransform (although obsolete/deprecated since .NET 2.0) or MSXML (why with .NET code?) then you would need to change your XSLT code to use a different Microsoft specific namespace.
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
Old March 12th, 2013, 09:34 AM
Authorized User
Join Date: Apr 2008
Posts: 85
Thanks: 10
Thanked 0 Times in 0 Posts

Thanks Martin for the reply, It has cleared the things.

Many Thanks

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem Converting C# to VB.NET in ASP.NET kwilliams ASP.NET 2.0 Basics 0 February 9th, 2007 06:22 PM
problem in VB.NET? bhavna VS.NET 2002/2003 0 January 22nd, 2007 07:48 AM
Problem with Exercise in Beg. asp.net for VB.net! mrfella71 BOOK: Beginning ASP.NET 1.0 1 October 23rd, 2005 12:06 PM
A vb.net beginner problem kitsam VB.NET 2002/2003 Basics 0 August 23rd, 2004 03:41 AM
XML to XML through an XSLT (VB.NET) dimondwoof XSLT 1 June 25th, 2003 12:07 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.