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

Re: outputting mutiple html files

Subject: Re: outputting mutiple html files
From: David Elsmore <delsmore@xxxxxxxxxxxxx>
Date: Tue, 27 Apr 2004 08:32:09 +0100
outputting xml into html
George,

Thank you so much, this is perfect!

David

George Cristian Bina wrote:

Hi David,

When you match a session you can apply the templates further only on the elements following the current session until the next session element instead of the elements inside the current session element.

Assuming the following input document:

<?xml version="1.0" encoding="UTF-8"?>
<test>
  <section>section one</section>
  <para>para1</para>
  <para>para2</para>
  <section>section two</section>
  <para>para3</para>
</test>

then the following stylesheet

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<xsl:apply-templates select="test/section"></xsl:apply-templates>
</xsl:template>
<xsl:template match="section">
<!-- create section file file -->
section
<xsl:variable name="sid" select="generate-id(.)"/>
<xsl:apply-templates select="following-sibling::*[name()!='section' and generate-id(preceding-sibling::section[1])=$sid]"/>
</xsl:template>


    <xsl:template match="para">
      <xsl:value-of select="."/>
    </xsl:template>

</xsl:stylesheet>


will get as output:


      section
      para1para2

      section
      para3


Hope that helps, George ----------------------------------------------- George Cristian Bina <oXygen/> XML Editor - http://www.oxygenxml.com



David Elsmore wrote:

I want to transform an xml file, outputting separate sections into multiple html documents. If the xml was srtructured as follows I would have no problem, I could simply use <xsl:for-each select="section">

<section>
<title>section one</title>
<para/>
<para/>
</section>

However, the structure of the xml file (over which I have no control) is more like:

<section>section one</section>
<para/>
</para>
<section>section two</section>
<para/>...

The section tags, rather than wrap separate areas of content merely indicate where a new section begins

Is there an easy way to do this?


Thanks for your help


David



-- David Elsmore IT Development Manager School of Social Sciences and Law Oxford Brookes University Tel: 01865 484176 email: delsmore@xxxxxxxxxxxxx

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.