Re: [xml-dev] are the regular expressions over xml structure?

From
Oleg Parashchenko <>
To
Andrew Welch <>
Date
2012-07-02T13:50:46Z
ID
<>
Thread
Re: [xml-dev] are the regular expressions over xml structure?
Hello Andrew,

On Mon, 2 Jul 2012 14:07:26 +0100
Andrew Welch <> wrote:

...
> > "element(image), element(caption), element(table[some condition])"
...
> You could do it with match patterns:
> 
>     <xsl:template match="image">
>         image element not followed by caption and table[condition]
>     </xsl:template>
> 
>     <xsl:template
> match="image[following-sibling::*[1][self::caption]]
> [following-sibling::*[2][self::table[@type = '1']]]">
>         the group
>     </xsl:template>

Unfortunately, this code is not enough. Imagine a mostly identity
transform with such grouping. What to do with the elements "caption"
and "table"?

* In "the group" mode, copy them
* Otherwise, ignore them

The latter -- detect if an element should be ignored -- requires
a complicated matching code.

> 
> 
> -- 
> Andrew Welch
> http://andrewjwelch.com
> 


-- 
Oleg Parashchenko  olpa@ http://uucode.com/
http://uucode.com/blog/  XML, TeX, Python, Mac, Chess