473,725 Members | 1,781 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(Serv er.MapPath("XSL Links.xslt"))

Dim XmlLinks As XmlElement
Dim XmlNewLink As XmlElement
XmlLinks = myXml.SelectSin gleNode("//xsl:stylesheet" )
XmlNewLink = myXml.CreateEle ment("xsl:templ ate")
XmlLinks.Append Child(XmlNewLin k)
myXml.Save(Serv er.MapPath("XSL Links.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 1480
jernej goricki wrote:

XmlLinks = myXml.SelectSin gleNode("//xsl:stylesheet" )


It won't work. You have to provide XmlNamespaceMan ager to resolve xsl
namespace prefix in //xsl:stylesheet expression.
See samples in SelectSingleNod e 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("XSLLi nks.xslt"))

'Create an XmlNamespaceMan ager for resolving namespaces.
Dim nsmgr As XmlNamespaceMan ager = New XmlNamespaceMan ager(doc.NameTa ble)
nsmgr.AddNamesp ace("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.DocumentEle ment
book = root.SelectSing leNode("stylesh eet", nsmgr)


"Oleg Tkachenko" <oleg@NO_SPAM_P LEASEtkachenko. com> wrote in message
news:Oa******** ******@TK2MSFTN GP12.phx.gbl...
jernej goricki wrote:

XmlLinks = myXml.SelectSin gleNode("//xsl:stylesheet" )
It won't work. You have to provide XmlNamespaceMan ager to resolve xsl
namespace prefix in //xsl:stylesheet expression.
See samples in SelectSingleNod e 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 XmlNamespaceMan ager for resolving namespaces.
Dim nsmgr As XmlNamespaceMan ager = New XmlNamespaceMan ager(doc.NameTa ble)
nsmgr.AddNamesp ace("xsl", "xsl:http://www.w3.org/1999/XSL/Transform")

No, it should be
nsmgr.AddNamesp ace("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_P LEASEtkachenko. com> wrote in message
news:%2******** ********@TK2MSF TNGP10.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 XmlNamespaceMan ager for resolving namespaces.
Dim nsmgr As XmlNamespaceMan ager = New XmlNamespaceMan ager(doc.NameTa ble) nsmgr.AddNamesp ace("xsl", "xsl:http://www.w3.org/1999/XSL/Transform")

No, it should be
nsmgr.AddNamesp ace("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
1535
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 editing... I don't see an easy way to do this except to create a lookup array that contains an index and a KEY - the index will then be associated with the VALUE in listbox... this seems like a pretty messy way to do this, so I'd like to avoid it if...
4
4318
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
1368
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 set me on my way. Is there something like this available or can somebody give me some example lines that creates and saves some XML data?
2
3904
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 "crumb-trail" of links. I'm transforming the XML with XSLT through Saxon. The nav menu and "crumb-trail" show the user where they are within the site and is made by reflecting the XML tree structure. My problem now is that when I want to generate...
19
1391
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 the way from MacOs09, IE5 to Firefox). Because our product sometimes puts large
22
1920
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 TestText entity is not recognised. In IE6, the <br /> tag doesn't cause a line break. Can anyone tell me what I'm doing wrong?
2
2568
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 empty squares. But the program worked. I looked up some docs, found the following recipe on the PyGTK Wiki site: http://starship.python.net/crew/theller/moin.cgi/Py2exeAndPyGTK I followed those instructions to convert my setup.py file;...
18
1283
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, but once the size exceeded 10 million the zip function slowed to a crawl. Note that there was memory available to store over 100 million items. Now I know that zip () wastes lots of memory because it copies the content of the lists, I had used...
0
1506
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 GridViews allows editing so I enable ViewState on that one. The other one does not so I disable ViewState on that one. The problem is that the one with the ViewState disabled is reporting correct row numbers while the other one does not. I can...
0
8747
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9162
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9091
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8069
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5997
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3211
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2619
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2150
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.