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

Re: limitations of xslt

Subject: Re: limitations of xslt
From: Francis Norton <francis@xxxxxxxxxxx>
Date: Sun, 24 Oct 1999 19:23:31 +0100
limitations of xslt
You will find that the following gives you what you want - not
commented, but I've tried to keep it simple by flattening the structure.

Not sure how scaleable this approach compared to others - any comments,
anyone?

Francis.	



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

<xsl:output method="xml" indent="yes"/>

<xsl:template match="/">
  <result>
    <xsl:apply-templates select="//title" />
  </result>
</xsl:template>

<xsl:template match="title">
  <section>
    <sectionTitle>
      <xsl:value-of select="text()" />
    </sectionTitle>
    <xsl:apply-templates
select="following-sibling::*[1][not(self::title)]" />
  </section>
</xsl:template>

<xsl:template
match="bullet[preceding-sibling::*[1][not(self::bullet)]]">
  <ul>
    <li>
      <xsl:value-of select="text()" />
    </li>
    <xsl:apply-templates select="following-sibling::*[1][self::bullet]"
/>
  </ul>
  <xsl:apply-templates
select="following-sibling::*[not(self::bullet)][1][not(self::title)]" />
</xsl:template>

<xsl:template match="bullet">
  <li>
    <xsl:value-of select="text()" />
  </li>
  <xsl:apply-templates select="following-sibling::*[1][self::bullet]" />
</xsl:template>

<xsl:template match="normal">
  <text>
    <xsl:value-of select="text()" />
  </text>
  <xsl:apply-templates
select="following-sibling::*[1][not(self::title)]" />
</xsl:template>

</xsl:stylesheet>

Earl Bingham wrote:
> 
> Here is my input file:
> 
> <?xml version="1.0"?>
> <textItems>
>    <title>Here is my first title!</title>
>    <bullet>first group first bullet</bullet>
>    <bullet>first group second bullet</bullet>
>    <normal>first group first normal</normal>
>    <bullet>first group third bullet</bullet>
>    <title>Here is my second title!</title>
>    <bullet>second group first bullet</bullet>
>    <normal>second group first normal</normal>
>    <bullet>second group second bullet</bullet>
>    <bullet>second group third bullet</bullet>
> </textItems>
> 
....


 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.