Parsing content between sibling nodes in poorly formed documents

A

alex.cline

I'm trying to write an XSL parser to extract all information between
two sibling nodes. The problem is, the documents are very poorly
formatted and that's where I'm running into difficulty. Here is an
example of the layout of the document:

<root>
<header>
content
</header>
<node />

content to extract.

<node />
<footer>
content
</footer>
</root>

I'm trying to extract all content between the two <node /> elements.
The data can include either text or other nested elements.

Thank you.

-- Alex
 
D

David Carlisle

I'm trying to write an XSL parser to extract all information between
two sibling nodes. The problem is, the documents are very poorly
formatted and that's where I'm running into difficulty. Here is an
example of the layout of the document:

<root>
<header>
content
</header>
<node />

content to extract.

<node />
<footer>
content
</footer>
</root>

I'm trying to extract all content between the two <node /> elements.
The data can include either text or other nested elements.

Thank you.

-- Alex

/root/*[preceding-sibling::node and following-sibling::node]

David
 
J

Joseph Kesselman

I'm trying to write an XSL parser

Uhm. Terminology problem there. Do you mean an XML parser, or an XSLT
processor, or an XSLT stylesheet?

Hard to give you a good answer without being sure what question you're
asking.
 
A

alex.cline

/root/*[preceding-sibling::node and following-sibling::node]

David

Thanks. Your solution led me to mine:

/root/*[preceding-sibling::node and following-sibling::node]|/root/
text()[preceding-sibling::node and following-sibling::node]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,008
Messages
2,570,271
Members
46,875
Latest member
TabithaSta

Latest Threads

Top