Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > match interior of XML tag using XSL

Reply
Thread Tools

match interior of XML tag using XSL

 
 
dzieciou
Guest
Posts: n/a
 
      06-11-2004
I've used JENA and got the following result in result of query to RDF
file:

<j.0:ResultSet>
<j.0:solution rdfarseType="Resource">
<j.0:binding rdfarseType="Resource">
<j.0:value>John Smith</j.0:value>
<j.0:variable>fname</j.0:variable>
</j.0:binding>
<j.0:binding rdfarseType="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.
 
Reply With Quote
 
 
 
 
Joe Fawcett
Guest
Posts: n/a
 
      06-11-2004
"dzieciou" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> I've used JENA and got the following result in result of query to RDF
> file:
>
> <j.0:ResultSet>
> <j.0:solution rdfarseType="Resource">
> <j.0:binding rdfarseType="Resource">
> <j.0:value>John Smith</j.0:value>
> <j.0:variable>fname</j.0:variable>
> </j.0:binding>
> <j.0:binding rdfarseType="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)


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to remove salt stains from car interior? DC Computer Support 14 03-13-2011 04:25 AM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
XSL Question tp xsl:for-each and xsl:variable schaf@2wire.ch XML 1 05-27-2005 09:25 PM
Sony DSC-S85 has interior Corrosion damage...Repair or Repalce? Opinions? hda Digital Photography 1 12-19-2003 02:34 AM
use xsl:element to output an "<xsl:template match=...> ? Ray Tayek XML 3 11-30-2003 10:14 AM



Advertisments