|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] General algorithm for finding nodes between PIs
Hello All,
I have XML with a bunch of different processing instructions in them; here
is a sample:
<?xml version="1.0" encoding="UTF-8"?>
<info>
<?Fm Condstart VbV-VCO?>
<p>For this, use <b>that </b>to do that.</p>
<?Fm Condend VbV-VCO?>
<p><?Fm Condstart USB?>If you need this, do that.<?Fm Condend USB?></p>
</info>
For each "pair" of processing instructions (Condstart and Condend with the
same string), I want to find all of the nodes between them. I have this:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:output indent="yes"/>
<xsl:template match="/">
<xsl:apply-templates
select="descendant::node()[preceding-sibling::processing-instruction('Fm')[.
='Condstart
VbV-VCO']][following-sibling::processing-instruction('Fm')[.='Condend
VbV-VCO']]"/>
</xsl:template>
<xsl:template match="node()">
<xsl:copy-of select="."/>
</xsl:template>
</xsl:stylesheet>
which essentially works. But what I am looking for is a general algorithm
for doing this with dozens of pairs like this. I am thinking that I can set
up a lookup xml file with a list of the names and then process the list. Any
suggestions would be appreciated. Thank you very much.
Rick Quatro
Carmen Publishing Inc.
rick@xxxxxxxxxxxxxxx
585-366-4017
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








