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

RE: BreakPoint in an xml document

Subject: RE: BreakPoint in an xml document
From: "Michael Kay" <michael.h.kay@xxxxxxxxxxxx>
Date: Fri, 3 Jan 2003 12:34:59 -0000
xsl breakpoint
In principle you can do this as:

<xsl:template match="BREAK" priority="3"/>

<xsl:template match="*[not(preceding::BREAK)]" priority="2">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>

<xsl:template match="*" priority="1"/>

But the performance might be very poor.

Faster solutions might be possible if you know where the BREAK element
can legitimately occur.

One way of speeding it up might be to do a pre-pass in which the
"top-level" elements (<level2>) are annotated with a BREAK attribute if
they contain a descendant BREAK element; you can then do the top-level
processing (in the second pass) as

<xsl:apply-templates
select="level2[not(preceding-sibling::*[@BREAK])]"/>

of if the BREAK is expected to appear near the start, process the level2
siblings recursively.

Michael Kay
Software AG
home: Michael.H.Kay@xxxxxxxxxxxx
work: Michael.Kay@xxxxxxxxxxxxxx 






> -----Original Message-----
> From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> [mailto:owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Chandra -
> Sent: 03 January 2003 02:26
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  BreakPoint in an xml document
> 
> 
> Hi all,
>    First of all, WISH YOU ALL A VERY HAPPY AND PROSPEROUS NEW 
> YEAR. Heres my question:
>   I am currently converting one xml file into another using a 
> XSL stylesheet. However, the original xml file  contains a 
> tag which is like a 
> "break point". Anything tag below this breakpoint shouldn't 
> be processed.
>   For eg:
> <level1>
>   <level2>
>     .....
>   </level2>
>   <level2>
>    ...
>   </level2>
>   <level2>
>     ...<BREAK>BreakPoint</BREAK>
>   </level2>
>   <level2
>     ....
>   </level2>
>   <level2>
>    .....
>   </level2>
> </level1>
> 
> In the above example, any tag below <BREAK> shouldn't be 
> processed i.e all <level2> tags and their children that come 
> below <BREAK> shouldn't be 
> processed.When I say "shouldn't be processed", I mean that 
> the tags or their 
> contents shouldn't be displayed in the final transformed 
> document. Is this 
> possible using a XSL stylesheet? I am guessing its not and 
> the only solution 
> is parse it using DOM in java?
> Thanks in advance
> Regards,
> Chandra
> 
> 
> _________________________________________________________________
> MSN 8 with e-mail virus protection service: 2 months FREE* 
> http://join.msn.com/?page=features/virus
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.