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

Re: Why I want to change the value of a variable.

Subject: Re: Why I want to change the value of a variable.
From: David Carlisle <davidc@xxxxxxxxx>
Date: Tue, 26 Oct 1999 13:06:23 +0100 (BST)
chris dupont
> So why is it called 'variable'?
 
well in an earlier draft it was called a constant, but it got changed
(rightly I think). It can have different values in different scopes so
`constant' is a confusing name, and variable corresponds with the
terminology of other functional languages such as standard ML.


> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"

which XSL engine are you using? That has not been the XSL namespace URI
for a _long_ time. None of the current XSL engines will work with that
except IE5. If you are using IE5 please say so, as the `XSL' implemented
there is basically a completely different language that happens to hace
the same name.

The version below appears to do the right thing given a current XSL
engine. On xt it currently adds one extra xmlns:X attribute to the
top level html element but that is a known issue, and shouldn't do any
harm.


Note I lowercased all your HTML elements. You should get used to that,
after HTML4, HTML will be XML based, with elements all lowercase.

David


<xsl:stylesheet 
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns:X="file:/dev/null"
>

<xsl:output type="html"/>

<X:letters>
<X:letter name="A"/>
<X:letter name="B"/>
<X:letter name="C"/>
<X:letter name="D"/>
<X:letter name="E"/>
<X:letter name="F"/>
<X:letter name="G"/>
<X:letter name="H"/>
<X:letter name="I"/>
<X:letter name="J"/>
<X:letter name="K"/>
<X:letter name="L"/>
<X:letter name="M"/>
<X:letter name="N"/>
<X:letter name="O"/>
<X:letter name="P"/>
<X:letter name="Q"/>
<X:letter name="R"/>
<X:letter name="S"/>
<X:letter name="T"/>
<X:letter name="U"/>
<X:letter name="V"/>
<X:letter name="W"/>
<X:letter name="X"/>
<X:letter name="Y"/>
<X:letter name="Z"/>
</X:letters>

<xsl:template match="/">
  <html>
    <head><title>People list</title></head>
    <body>
      <xsl:variable name="here" select="."/>
      <xsl:for-each select="document('')/xsl:stylesheet/X:letters/X:letter/@name">
         <center>-<xsl:value-of select="."/>-</center>
         <xsl:choose>
         <xsl:when test="$here/LIST_PEOPLE/PEOPLE[starts-with(NAME,current())]">
           <xsl:for-each select="$here/LIST_PEOPLE/PEOPLE[starts-with(NAME,current())]">
             <xsl:sort select="NAME"/>
             <xsl:value-of select="FIRST_NAME"/><xsl:text> </xsl:text>
             <xsl:value-of select="NAME"/><br/><xsl:text>
           </xsl:text>
           </xsl:for-each>
         </xsl:when>
         <xsl:otherwise>
            nobody
         </xsl:otherwise>
         </xsl:choose>
      </xsl:for-each>
    </body>
  </html>
</xsl:template>

</xsl:stylesheet>





produces this on your input






<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns:X="file:/dev/null">
<head>
<title>People list</title>
</head>
<body>
<center>-A-</center>Gweltaz Ar Fur<br>
           <center>-B-</center>
            nobody
         <center>-C-</center>
            nobody
         <center>-D-</center>Marc Duchmol<br>
           Chris Dupont<br>
           Maria Dupuis<br>
           Yves Durant<br>
           <center>-E-</center>
            nobody
         <center>-F-</center>
            nobody
         <center>-G-</center>
            nobody
         <center>-H-</center>
            nobody
         <center>-I-</center>
            nobody
         <center>-J-</center>
            nobody
         <center>-K-</center>Sam Kememer<br>
           <center>-L-</center>Laurent Leclercq<br>
           Emmanuel Leguy<br>
           Florence Lerouge<br>
           <center>-M-</center>
            nobody
         <center>-N-</center>
            nobody
         <center>-O-</center>
            nobody
         <center>-P-</center>Gilles Presley<br>
           <center>-Q-</center>
            nobody
         <center>-R-</center>Eve Ramone<br>
           <center>-S-</center>Marie-Pierre Smith<br>
           Alan Stivell<br>
           <center>-T-</center>
            nobody
         <center>-U-</center>
            nobody
         <center>-V-</center>
            nobody
         <center>-W-</center>
            nobody
         <center>-X-</center>
            nobody
         <center>-Y-</center>
            nobody
         <center>-Z-</center>
            nobody
         </body>
</html>


 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.