[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: General algorithm for finding nodes between PIs

Subject: Re: General algorithm for finding nodes between PIs
From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 27 Jan 2017 15:06:49 -0000
Re:  General algorithm for finding nodes between PIs
On 27.01.2017 15:57, Rick Quatro rick@xxxxxxxxxxxxxx wrote:
Thanks for the reply. What I really want is this:

Input:

<?xml version="1.0" encoding="UTF-8"?>
<info>
    <?Fm Condstart VbV-VCO?>
    <p>For this, use <b>that </b>to do that.</p>
    <p>Another paragraph</p>
    <?Fm Condend VbV-VCO?>
    <p><?Fm Condstart USB?>If you need this, do that.<?Fm Condend USB?></p>
    <p>Outside paragraph.</p>
</info>

Output:

<?xml version="1.0" encoding="UTF-8"?>
<info>
    <p platform="VbV-VCO">For this, use <b>that </b>to do that.</p>
    <p platform="VbV-VCO">Another paragraph</p>
    <p platform="USB">If you need this, do that.</p>
    <p>Outside paragraph.</p>
</info>

The basic logic is this: given a "Condstart" processing instruction:

* If the first sibling is an element, then assign an attribute to all
following sibling elements up to the corresponding Condend processing
instruction.

* If the first sibling is a text node, then assign an attribute to the
parent of the Condstart processing instruction.

Pulling up the pi value to the parent requires a different approach, I think. I wonder what happens if there is an element containing several pis, let's say, there is


<p><?Fm Condstart USB?>If you need this, do that.<?Fm Condend USB?>text<?Fm Condstart foo?>Some text<?Fm Condend foo?>another text</p>

which output do you want in that case?

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.