This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
Re: Suggestion for XSLT 2.0
- To: xsl-list at mulberrytech dot com
- Subject: Re: Suggestion for XSLT 2.0
- From: Paul Tchistopolskii <paul at qub dot com>
- Date: Sun, 10 Sep 2000 18:57:54 -0700
- Organization: The Qub Group
- References: <C1DD8B5BC729D311A68D00A0C9EA8BF801315A37@mail>
- Reply-To: xsl-list at mulberrytech dot com
----- Original Message -----
From: Matthew Bentley
> In XSLT, at the moment, if you want to check if the preceding-sibling is a
> particular element type, lets say, 'heading', then the following code is
> necessary:
>
> test="preceding-sibling::*[self::heading and position() = 1]"
>
> It seems to me that this situation (I.e testing the type of an immediately
> neighbouring element) is fairly common and there should be some abbreviation
> for it for preceding, following, preceding-sibling and following-sibling.
> Anybody agree?, disagree?
I think you are not the only one who feels that current
Xpath is more verbose than it could be.
I was thinking about
some[ -1 ] for preceding-sibling of element 'some'
some[ +1 ] for following-sibling of element 'some'
some[ 1 ] for first child of element 'some'
Rgds.Paul.
<offtopic>
PS. Considering attribute to be ordinary child
element also simplifies a model ( and 'everything' ).
The only drawback ( scientifically valid,
but almost not existent in the real life ) is that there
should be no attribute with the name equal to
the name of child element. Considering
PCDATA to be a special element <_> also
simplifies some things. In fact this all is MinML
model, not XML model, so sorry for offtopic -
just wanted to point out some other view
which sometimes makes things easier.
</offtopic>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list