xsl-list
[Top] [All Lists]

RE: [xsl] can this idea work ?

2012-02-10 10:07:15

Sorry for the missing data. 

 

Here a simpliefied xslt with everything needed.

 

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

 

<xsl:output method="xml"
 doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
 doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
 omit-xml-declaration="yes"
 encoding="UTF-8"
 indent="yes" />


 

<xsl:template match="/">

           <xsl:apply-templates select="data" />

</xsl:template>

 

<xsl:template match="data">
      <xsl:apply-templates select="dagboek/entry"/>
</xsl:template>

</xsl:stylesheet>

 

<xsl:template match="dagboek/entry" >
    <h3> 
    <xsl:value-of select="titel" /> 
  </h3>
     <xsl:apply-templates select="dagboek/entry[nieuwe-pagina = 'yes']" 
mode="pagegroup" />
      <xsl:apply-templates select="tekst" />
   </div>
</xsl:template>

 

<xsl:template match="entry" mode="pagegroup">
       <xsl:apply-templates select=". | 
following-sibling::entry[not(nieuwe-pagina = 'yes') and 
preceding-sibling::entry[nieuwe-pagina = 'yes'][1] = current()]" /> 
</xsl:template>

</xsl:stylesheet>

 

 

<xsl:template match="tekst//p[starts-with(., 'FLOAT : ')]" priority="1">
    <img class="float-left" src="{$workspace}/images/{substring-after(., 'FLOAT 
: ')}" />
</xsl:template>

 

<xsl:template match="tekst//*">
    <xsl:element name="{name()}">
        <xsl:apply-templates select="* | @* | text()"/>
    </xsl:element>
</xsl:template>

 

<xsl:template match="tekst//@*">
    <xsl:attribute name="{name(.)}">
        <xsl:value-of select="."/>
    </xsl:attribute>
</xsl:template>

 

 

And here the simpliefied xml : 

 

<data>

     <dagboek>

            <section id="9" handle="dagboek">Dagboek</section> 41    

             <entry id="20">

                <nieuwe-pagina>Yes</nieuwe-pagina> 

                <tekst mode="formatte"">

                     Article 1

                </tekst> 

                <titel handle="nekplooimeting">Nekplooimeting </titel> 

                <datum time="00:00" weekday="5">2005-04-01</datum>

             </entry> 

             <entry id="21"> 

               <nieuwe-pagina>Yes</nieuwe-pagina> 

               <tekst mode="formatted">

                   Article 2

               </tekst> 

                    <titel handle="vlokkentest">Vlokkentest ?</titel> 

                    <datum time="19:16" weekday="1">2005-04-04</datum> 

            </entry>

        </dagboek>

</data>

 

What I was expecting was a page where only the first arcticle and the article 
between the first article and the next article with <nieuwe-pagina = "yes"> is 
displayed.

Now it's schowing both articles where I was expecting to see only the first 
article.

 

 

 

 

 

 

 

 

---------------------------------------- > Date: Fri, 10 Feb 2012 12:40:20 
+0000 > From: davidc(_at_)nag(_dot_)co(_dot_)uk > To: 
xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com > CC: 
rwobben(_at_)hotmail(_dot_)com > Subject: Re: [xsl] can this idea work ? > > On 
10/02/2012 12:29, Roelof Wobben wrote: > > So I thought this xslt 1.0 could do 
the job : > > > > > > you haven't said what output you expected from the 
stylesheet or what > output you got, and we can't run the code you posted as it 
imports files > you have not posted. > > If the imported files are not relevant 
to your problem make a small > (without all the irrelevant text and elements) 
input file and a small > complete runnable xsl stylesheet and then say what 
output you got and > what output you expected/wanted. > > David > > 
________________________________________________________________________ > The 
Numerical Algorithms Group Ltd is a company registered in England > and Wales 
with company number 1249803. The registered office is: > Wilkinson House, Jorda!
 n Hill Road, Oxford OX2 8DR, United Kingdom. > > This e-mail has been scanned 
for all viruses by Star. The service is > powered by MessageLabs. > 
________________________________________________________________________        
                               
--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--


<Prev in Thread] Current Thread [Next in Thread>