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

Re: How to use the same expression in a match and a s

Subject: Re: How to use the same expression in a match and a select test
From: Sascha Mantscheff <922492@xxxxxx>
Date: Mon, 03 Dec 2007 14:49:20 +0100
Re:  How to use the same expression in a match and a  s
Am Montag, den 03.12.2007, 19:03 +0530 schrieb Mukul Gandhi:
> I would say, this is not possible with standard XSLT. Probably some
> extension exists for this; but I don't know about such extensions ...
> 
> I think, in your case, it's only a lexical redundancy. It should not
> affect the performance of your stylesheet.

Yes, but it does affect the legibility and maintainability of the
stylesheet. 

> 
> 
> On Dec 3, 2007 6:51 PM, Sascha Mantscheff <922492@xxxxxx> wrote:
> > I have a stylesheet with a template and a for-each statement.
> > Both select their elements by an expression which differs only in one
> > part from each other.
> >
> > The template is:
> >
> > <xsl:template match="*[not(self::blockquote|self::center|self::BODY|
> > self::body|self::div|self::dl|self::dt|self::HEAD|self::head|self::HTML|
> > self::img|self::h1|self::h2|self::h3|self::h4|self::h5|self::h6|
> > self::hr|self::html|self::idx:*|self::form|
> > self::mbp:*[not(self::mbp:nu)]|self::mmc:*|self::ol|self::p|self::table|
> > self::td|self::th|self::tr|
> > self::ul)][preceding-sibling::node()[1][name()=name(current()) and
> > string-join(@*,'xx') = string-join(current()/@*,'xx')]]"
> > />
> >
> > The for-each select is:
> >
> > <xsl:for-each select="following-sibling::node()[1][not(self::blockquote|
> > self::center|self::BODY|self::body|self::div|self::dl|self::dt|
> > self::HEAD|self::head|self::HTML|self::img|self::h1|self::h2|self::h3|
> > self::h4|self::h5|self::h6|self::hr|self::html|self::idx:*|self::form|
> > self::mbp:*[not(self::mbp:nu)]|self::mmc:*|self::ol|self::p|self::table|
> > self::td|self::th|self::tr|self::ul)] [name()=name(current()) and
> > string-join(@*,'xx') = string-join(current()/@*,'xx')]">
> >
> > How can I reduce the redundancy and use the same expression in both
> > statements, like in this pseudo code:
> >
> > <xsl:template
> > match="*[$NO_BLOCK_ELEMENTS][preceding-sibling::node()[1][name()=name(current()) and $SAME_ATTRIBUTES]]"
> > />
> >
> > <xsl:for-each select="following-sibling::node()[1][$NO_BLOCK_ELEMENTS]
> > [name()=name(current()) and $SAME_ATTRIBUTES]">

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.