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

for-each variable combination producing different outp

Subject: for-each variable combination producing different output
From: "Andrew Welch" <andrew@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 11 Jun 2001 12:15:50 +0100
for each variable
Hi,

Im using for-each mappings in my xsl files to display the contents of my xml
files.  One xsl file, called all.xsl, simply displays records.  Other xsl
files, store the 'result' tree in a variable then use a for-each mapping to
step through the results.

The problem is that when I use a $results variable I get a different output
to just accessing nodes through an xpath expression.

I test to see if certain nodes exist in the xml file, if they do some links
are output.  However, if a variable is used for the for-each mapping, all of
the links appear at the top of the output seemingly as if they have been
processed before the rest of the xml.

Ive read that using for-each misses the point of xsl, and that I should be
using templates.  Is this the case and would it solve this problem??

Many Thanks

andrew

===extract of all.xsl, this works fine==========
<xsl:for-each select="TBD/business">
    <xsl:sort select="."/>
    <tr>
      <td width="230" style="font-weight:bold;">

        <xsl:choose>
          <xsl:when test="link!=''">
            <a><xsl:attribute name="href"><xsl:value-of
select="link"/></xsl:attribute><xsl:value-of select="name"/></a>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="name"/>
          </xsl:otherwise>
        </xsl:choose>

        ********this code seems to be run first********
        <xsl:if test="postcode!=''">
          <a><xsl:attribute
name="class">little_link</xsl:attribute><xsl:attribute
name="href">http://uk.multimap.com/p/browse.cgi?pc=<xsl:value-of
select="translate(postcode,' ','')"/></xsl:attribute><xsl:attribute
name="target">new</xsl:attribute> map </a>
        </xsl:if>
        <xsl:if test="email!=''">
          <a><xsl:attribute
name="class">little_link</xsl:attribute><xsl:attribute
name="href">mailto:<xsl:value-of select="email"/></xsl:attribute> email </a>
        </xsl:if>
        <xsl:if test="website!=''">
          <a><xsl:attribute
name="class">little_link</xsl:attribute><xsl:attribute
name="href"><xsl:value-of select="website"/></xsl:attribute><xsl:attribute
name="target">new</xsl:attribute> webiste </a>
        </xsl:if>
       **************************
      </td>
      <td width="220" rowspan="2" style="font-size:150%;"><xsl:value-of
select="telephone"/></td>
      <td rowspan="2">
.........
========================

other files use
=====
<xsl:for-each select="$results">
======
as the for-each mapping, which outputs the results of the if-tests at the
top of the xml.
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.260 / Virus Database: 131 - Release Date: 06/06/2001


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread
  • [no subject]
    • edouard panie - Sun, 10 Jun 2001 11:28:38 -0400 (EDT)
      • Andrew Welch - Mon, 11 Jun 2001 07:16:39 -0400 (EDT) <=

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.