473,395 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Troubles with editing XSLT doc

Hy I'm trying to edit a XSLT document, just like I'm editing a XML document
:
(Im trying to make a new xsl:template tag here )
Dim myXml As New XmlDocument()
myXml.Load(Server.MapPath("XSLLinks.xslt"))

Dim XmlLinks As XmlElement
Dim XmlNewLink As XmlElement
XmlLinks = myXml.SelectSingleNode("//xsl:stylesheet")
XmlNewLink = myXml.CreateElement("xsl:template")
XmlLinks.AppendChild(XmlNewLink)
myXml.Save(Server.MapPath("XSLLinks.xslt"))
But instead I get this error:

Namespace Manager or XsltContext needed. This query has a prefix, variable,
or user-defined function.

Do I have to edit a xslt document in a different way?
Thanks for your answer!

Nov 11 '05 #1
4 1455
jernej goricki wrote:

XmlLinks = myXml.SelectSingleNode("//xsl:stylesheet")


It won't work. You have to provide XmlNamespaceManager to resolve xsl
namespace prefix in //xsl:stylesheet expression.
See samples in SelectSingleNode method documentation at MSDN:
http://msdn.microsoft.com/library/de...enodetopic.asp

--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #2
Hm...
I have some troubles with understanding this example

Dim doc As XmlDocument = New XmlDocument()
doc.Load(Server.MapPath("XSLLinks.xslt"))

'Create an XmlNamespaceManager for resolving namespaces.
Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(doc.NameTable)
nsmgr.AddNamespace("xsl", "xsl:http://www.w3.org/1999/XSL/Transform")

........This probably isnt the right way to create a namespace for use in
xslt?

'Select the book node with the matching attribute value.
Dim book As XmlNode
Dim root As XmlElement = doc.DocumentElement
book = root.SelectSingleNode("stylesheet", nsmgr)


"Oleg Tkachenko" <oleg@NO_SPAM_PLEASEtkachenko.com> wrote in message
news:Oa**************@TK2MSFTNGP12.phx.gbl...
jernej goricki wrote:

XmlLinks = myXml.SelectSingleNode("//xsl:stylesheet")
It won't work. You have to provide XmlNamespaceManager to resolve xsl
namespace prefix in //xsl:stylesheet expression.
See samples in SelectSingleNode method documentation at MSDN:

http://msdn.microsoft.com/library/de...enodetopic.asp
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #3
jernej goricki wrote:
I have some troubles with understanding this example
Read more about namespaces then, this is quite important topic when
working with XML.
'Create an XmlNamespaceManager for resolving namespaces.
Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(doc.NameTable)
nsmgr.AddNamespace("xsl", "xsl:http://www.w3.org/1999/XSL/Transform")

No, it should be
nsmgr.AddNamespace("xsl", "http://www.w3.org/1999/XSL/Transform")

This associates xsl prefix with http://www.w3.org/1999/XSL/Transform
namespace name.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #4
ok thanks, just that I'm on the right way :)
"Oleg Tkachenko" <oleg@NO_SPAM_PLEASEtkachenko.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
jernej goricki wrote:
I have some troubles with understanding this example


Read more about namespaces then, this is quite important topic when
working with XML.
'Create an XmlNamespaceManager for resolving namespaces.
Dim nsmgr As XmlNamespaceManager = New XmlNamespaceManager(doc.NameTable) nsmgr.AddNamespace("xsl", "xsl:http://www.w3.org/1999/XSL/Transform")

No, it should be
nsmgr.AddNamespace("xsl", "http://www.w3.org/1999/XSL/Transform")

This associates xsl prefix with http://www.w3.org/1999/XSL/Transform
namespace name.
--
Oleg Tkachenko
http://www.tkachenko.com/blog
Multiconn Technologies, Israel

Nov 11 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Katie Beach | last post by:
I have a listbox in which I would like to be able to display a value of a hash, but when the user selects an element in the list, I need to be able to use the KEY associated with the value chosen for...
4
by: Daniel Cloutier | last post by:
Hi, is it possible to edit or write Word-files out of a Python-Program? thx in advance daniel
2
by: jaco | last post by:
Hi, I'm new to Python and XML but still I want to create something that includes creating and editing XML using Python. Now I'm looking for a little example program that does (some of) this to...
2
by: ted | last post by:
Was wondering if XSLT alone is appropriate for the following situation. From XML, I'm creating a small website (around 50 pages) with pages that link to each other through a nav menu and a...
19
by: bugbear | last post by:
I've been using this technique for around a year to create "decorated" tabs and round cornered boxes (windows?) http://www.alistapart.com/articles/slidingdoors/ Everything worked fine (all...
22
by: Ted | last post by:
This page http://homepage.ntlworld.com/r.a.mccartney/test/utf-8_test_file_hacked_for_ie_with_local_dtd.xml doesn't work properly in Firefox or IE6. The faults are different. In Firefox the...
2
by: Tim N. van der Leeuw | last post by:
I tried to create a windows executable of a pygtk program. My first attempt worked, kinda, except that no themes were applied and no readable fonts were found by pango; so all letters where just...
18
by: Istvan Albert | last post by:
Hello all, I've been debugging the reason for a major slowdown in a piece of code ... and it turns out that it was the zip function. In the past the lists that were zipped were reasonably short,...
0
by: SAL | last post by:
Hello, I have a small Web app that has a couple of pages in it. Both pages have gridviews on them with basically the same ObjectDataSource. This object data source is a business class. One of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.