Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 27th, 2004, 05:37 AM
Authorized User
 
Join Date: Sep 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default is it possible to leave for-each loop

Hi all
Me again!
Sorry for being a pain
I want to be able to leave a for-each loop

I have the follwoing xml

<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="err5.xsl"?>
<start>
   <build>
      <message>stuff blah5 stuffaft</message>
      <message>stuff blah: 1 stuffaft</message>
      <message>stuff blah2 stuffaft</message>
      <message>stuff bla h3 stuffaft</message>
      <message>stuff bl ah4 stuffaft</message>
      <message>stuff blah5 stuffaft</message>
      <message>stuff blah5 stuffaft</message>
      <message>stuff blah5 stuffaft</message>
      <message>stuff blah5stuffaft</message>
      <message>blah 12 stuffaft </message>
      <message>stuff blah5 stuffaft</message>
      <message>stuff blah1 stuffaft</message>
      <message>stuff blah4 stuffaft</message>
      <message>stuff blah1 stuffaft</message>
      <message>stuff blah1 stuffaft</message>
      <message>stuff blah1stuffaft</message>
      <message>stuff blah1stuffaft</message>
      <message>stuff blah1stuffaft</message>
      <message>stuff blah1stuffaft</message>
      <message>blah 12 stuffaft </message>
      <message>stuff blah1stuffaft</message>
   </build>
</start>
 ===========================

and xslt

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">


  <xsl:template match="/">
      <xsl:apply-templates select="start/*" />
  </xsl:template>

  <xsl:template match="message[contains(., 'blah: 1')]">
     <xsl:for-each select="following-sibling::message[following-sibling::message[contains(., 'blah 12')]]">
            <xsl:value-of select="." /><br />
     </xsl:for-each>
  </xsl:template>

  <xsl:template match="message" />
  <xsl:template match="message222" />

</xsl:stylesheet>

============================

I want to stop showing output when I get to the first blah 12. At the moment it shows the output up tot he second blah 12

Thanks
Richard



 
Old September 27th, 2004, 09:05 AM
Authorized User
 
Join Date: Sep 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I foudn an answer here:

http://www.biglist.com/lists/xsl-lis.../msg01528.html






Similar Threads
Thread Thread Starter Forum Replies Last Post
ToolStripMenuItem Enter & Leave Event angelboy C# 2005 6 November 21st, 2008 04:57 PM
Form and Combo Box Leave Trails on Screen Coby Excel VBA 4 August 4th, 2007 01:54 AM
nested while loop doesn't loop hosefo81 PHP Databases 5 November 12th, 2003 08:46 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.