473,671 Members | 2,442 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help: Problem with XML/XSL namespace matching

Dear fellows,

I have a problem with matching namespaces in an XML document and an
XSLT stylesheet (at least I think that this is the source of trouble).

My XML document looks like this:

1 <?xml version="1.0" encoding="ISO-8859-1" standalone="no" ?>
2 <!DOCTYPE relations SYSTEM "germanet_relat ions.dtd"[]>
3 <relations>
4 <con_rel name="hyperonym y" dir="one"
xmlns:xlink="ht tp://www.w3.org/1999/xlink" xlink:type="ext ended">
5 <locator xlink:type="loc ator"
xlink:href="adj .Allgemein.xml# aAllgemein.1"
xlink:label="aA llgemein.1"/>
6 <locator xlink:type="loc ator"
xlink:href="adj .Allgemein.xml# aAllgemein.2"
xlink:label="aA llgemein.2"/>
7 <arc xlink:type="arc " xlink:from="aAl lgemein.2"
xlink:to="aAllg emein.1" xlink:actuate=" onRequest" xlink:show="oth er"/>
8 </con_rel>
9 ....
10 </relations>

(line numbering for convenience)

My stylesheet looks like this:

1 <?xml version='1.0' encoding="iso-8859-1"?>
2 <xsl:styleshe et version="1.0"
xmlns:xsl="http ://www.w3.org/1999/XSL/Transform"
xmlns:xlink="ht tp://www.w3.org/1999/xlink/">
3
4 <xsl:output method="html" />
5
7 <xsl:template match="/">
8 <xsl:apply-templates select="//con_rel"/>
9 </xsl:template>

10 <xsl:template match="con_rel[@name='hyperony my']">
11 <xsl:value-of select="./arc[1]/@xlink:from" />
12 <xsl:text>
13 </xsl:text>
14 </xsl:template>
15 </xsl:stylesheet>

Produces only empty lines in the target document.

The namespace declarations in the source document (line 4) and in the
stylesheet (line 2) match (i.e. they point to the same URI)..

From the production of new lines in the target document I see that the
source document elements are "matched" (i.e., the template in line
10-14 is entered)

11 <xsl:value-of select="./arc[1]/@from" />

(without the ns prefix does not work either).

11 <xsl:value-of select="./arc[1]/@*[local-name()='from']" />

does indeed work, but the meaning is "I do not care about the
namespace prefix" what is not exactly what I want to do.

I used "xsltproc" and the Saxon parser 7.5, with the same results.

You help is very much appreciated.

Yours

Lothar Lemnitzer
Jul 20 '05 #1
1 1893
In article <35************ **************@ posting.google. com>,
Lothar Lemnitzer <lo****@sfs.u ni-tuebingen.de> wrote:
4 <con_rel name="hyperonym y" dir="one"
xmlns:xlink="h ttp://www.w3.org/1999/xlink" xlink:type="ext ended"> 2 <xsl:styleshe et version="1.0"
xmlns:xsl="htt p://www.w3.org/1999/XSL/Transform"
xmlns:xlink="h ttp://www.w3.org/1999/xlink/"> The namespace declarations in the source document (line 4) and in the
stylesheet (line 2) match


No, one has a slash on the end and the other doesn't.

Namespace names are matched literally, that is character-by-character.

-- Richard
Jul 20 '05 #2

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

Similar topics

1
2731
by: Henry | last post by:
I have a table that stores a list of zip codes using a varchar column type, and I need to perform some string prefix pattern matching search. Let's say that I have the columns: 94000-1235 94001 94100 If I run a pattern matching search for the string "940", then I should get the top two rows of data back. If I run a pattern matching search for the string "94", then I should get all the three rows of data back.
2
3926
by: wooks | last post by:
I want to apply 2 changes to the following xml <ROOTSTUB app="appname"/> 1. change the app attribute to an element. 2. put the ROOTSTUB element into a namespace that is passed as a global parameter at run time. so I want
15
1921
by: PhilB | last post by:
Hello experts, I am a complete beginner in C++ (although I know C). I am trying to compile the code below, and I get the following error. Can anyone explain to me my mistake? Thanks! PhilB myprog2.cpp: In method `Line::Line (Point, Point)': myprog2.cpp:32: no matching function for call to `Point::Point ()'
6
1184
by: stephane | last post by:
I am preparing an exam and I have a copy of last year exam. I answered the first questions and I wander if I am right or wrong. Can someone have a look at the questions and at my answers please? There is no code to write just general questions about the two class'. the code: /--
7
1430
by: stephane | last post by:
Hi, I must implement the method printLn of the class Thoraire. And I've done this, can someone tell me if I am right ?
0
1641
by: aredo3604gif | last post by:
I have coded a serie of singly linked lists in ANSI C which I have to use. The lists are then stored in a serie of buckets with chained hash table technique. In the various lists there are nodes that carry the same type of data in some of their node fields and some don't. In the various nodes , the struct datatype, there is a flag set to 1 for items that I need to remove. In the removing condition I have to add another match with an...
2
7470
by: pretear_yuki | last post by:
I'm a 14 year old student in Singapore. I am doing a programming for my Research Studies in school, I got the source codes of my programme from my mentor in the National University of Singapore Infocomm Research department. However, when I tried to compile the codes, I get the error message that says: "no matching function for call to `Englingo::addEnglingo(std::vector<int, std::allocator<int> >)' " The error is in the Englingo.cpp: #include...
11
2340
by: Matthias Pfeifer | last post by:
Hi there, I am trying to declare a function that takes a std::list<parameter. I want this function to have an empty list as a default parameter. It's a template function also. Currently i am stuck because my compiler does not find a matching function when i do a call. here is my code: // ############## code begins
4
3918
by: mustang07 | last post by:
I need this program to find all occurences of a name and display them. If I enter Palmer, I need it to display all the Palmers in the list. Can anyone help me Please. Thank You!! #include <iostream> #include <string> using namespace std; int main()
0
8483
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8926
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8824
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8603
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
7444
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...
1
6236
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4227
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
2818
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
1815
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.