473,386 Members | 1,867 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,386 software developers and data experts.

match interior of XML tag using XSL

I've used JENA and got the following result in result of query to RDF
file:

<j.0:ResultSet>
<j.0:solution rdf:parseType="Resource">
<j.0:binding rdf:parseType="Resource">
<j.0:value>John Smith</j.0:value>
<j.0:variable>fname</j.0:variable>
</j.0:binding>
<j.0:binding rdf:parseType="Resource">
<j.0:variable>x</j.0:variable>
<j.0:value rdf:resource="http://somewhere/JohnSmith/"/>
</j.0:binding>
</j.0:solution>
<j.0:ResultSet>

I wish it was transformed with XLS into something like this:

<resultset>
<solution>
<fname>John Smith</fname>
<x>http://somewhere/JohnSmith/</x>
</solution>
</resultset>

The main problem is how to match the interior of XML tag (i.e. fname)
and put it into <fname>. Thxn for any help or suggestion,

Maciek.
Jul 20 '05 #1
1 1552
"dzieciou" <ma****@mat.uni.torun.pl> wrote in message
news:84**************************@posting.google.c om...
I've used JENA and got the following result in result of query to RDF
file:

<j.0:ResultSet>
<j.0:solution rdf:parseType="Resource">
<j.0:binding rdf:parseType="Resource">
<j.0:value>John Smith</j.0:value>
<j.0:variable>fname</j.0:variable>
</j.0:binding>
<j.0:binding rdf:parseType="Resource">
<j.0:variable>x</j.0:variable>
<j.0:value rdf:resource="http://somewhere/JohnSmith/"/>
</j.0:binding>
</j.0:solution>
<j.0:ResultSet>

I wish it was transformed with XLS into something like this:

<resultset>
<solution>
<fname>John Smith</fname>
<x>http://somewhere/JohnSmith/</x>
</solution>
</resultset>

The main problem is how to match the interior of XML tag (i.e. fname)
and put it into <fname>. Thxn for any help or suggestion,

Maciek.

You have two options, the first is to declare the namespace that j.0 refers
to on your document (the above xml is invalid as it does not declare the
namespace)and match using this, the second is to match on local-name only:
1)
<xsl:stylesheet xmlns:j.0="<the full namespace uri goes here>" ..rest of
element...

<xsl:template match="j.0:ResultSet">
<xsl:element name="{local-name()}"></element>

2)
<xsl:stylesheet xmlns:j.0="<the full namespace uri goes here>" ..rest of
element...

<xsl:template match="*[local-name() = 'ResultSet']">
<xsl:element name="{local-name()}"></element>
--

Joe (MVP - xml)
Jul 20 '05 #2

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

Similar topics

1
by: elmlish | last post by:
Hello all, I'm currently befuddled as to how to efficiently test for a positive re. match then use the results of that match in a function. Mostly what I've seen people do is to first test for...
2
by: Catherine Lynn Wood | last post by:
I need to know how to overlap DIV content within 'relative' associated rendering. I am building div layers in the middle of a page and when I set positioning to absolute in the CSS, it references...
2
by: cricfan | last post by:
I'm parsing a text file to extract word definitions. For example the input text file contains the following content: di.va.gate \'di_--v*-.ga_-t\ vb pas.sim \'pas-*m\ adv : here and there :...
19
by: Tom Deco | last post by:
Hi, I'm trying to use a regular expression to match a string containing a # (basically i'm looking for #include ...) I don't seem to manage to write a regular expression that matches this. ...
3
by: Jeff McPhail | last post by:
I am using Regex.Match in a large application and the memory is growing out of control. I have tried several ways to try and release the memory and none of them work. Here are some similar examples...
32
by: Licheng Fang | last post by:
Basically, the problem is this: 'do' Python's NFA regexp engine trys only the first option, and happily rests on that. There's another example: 'oneself' The Python regular expression...
4
by: Dylan Nicholson | last post by:
I can write a regular expression that will only match strings that are NOT the word apple: ^(.*|a.*|ap.*|app.*|apple.+)$ But is there a neater way, and how would I do it to match strings that...
6
by: johntology | last post by:
Hello, I've made a two dimensional array using references, which I gather is the only way to do it in Perl. I now need to pass each interior array to a subroutine for processing and can't quite...
20
by: arnimavidyarthy | last post by:
Hi, Hi, I am taking a string as an input from the user and it should only contain the chars:L , M or R I tried the folllowing in kodos but they are still not perfect:
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...

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.