How to parse processing instruction?

View: New views
1 Messages — Rating Filter:   Alert me  

How to parse processing instruction?

by bkc :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I need to extract and parse <xml-stylesheet /> processing instruction
statements from xml files.

The Xquery book suggests  that string($pi) will return the contents and
name($pi) will return the pi name, but it does not.

let $source := doc('pitest.xml'),
$pi := $source//processing-instruction()[1]
return <x pi_count="{count($pi)}" pi_contents="{string($pi)}"
pi_name="{name($pi)}" />

returns:

<x pi_count="1" pi_contents="" pi_name="root"/>

given this source:

<?xml-stylesheet type="text/xsl" href="some_path" ?>
<root a="attra"/>

I am running rev 7998 from trunk

--
Brad Clements,                bkc@...    (315)268-1000
http://www.murkworks.com                         
AOL-IM: BKClements


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Exist-open mailing list
Exist-open@...
https://lists.sourceforge.net/lists/listinfo/exist-open
LightInTheBox - Buy quality products at wholesale price