xsl-list
[Top] [All Lists]

RE: [xsl] Xsl:variable content should be empty

2007-04-04 02:54:22
It seems to be objecting to the space between the start tag and end tag of
xsl:variable.

It's wrong to object to it: whitespace in this position should be stripped
and ignored.

But it's more conventional, if your xsl:variable has a select attribute, to
write

<xsl:variable name="link" select="file_link"/>

Michael Kay
http://www.saxonica.com/
 

-----Original Message-----
From: Alan Hale [mailto:alan(_dot_)hale(_at_)btclick(_dot_)com] 
Sent: 04 April 2007 10:31
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Xsl:variable content should be empty

I'm a relative newcomer to xslt and I wonder if someone could 
kindly explain to me what is the issue with the following use 
of xsl:variable and how I can correct it:

      <xsl:for-each select="/fieldguide/account">
            
      <xsl:variable name="link" select="file_link"> </xsl:variable>
      .
      .
      <td><a target = "_parent" href="{$link}"><xsl:value-of 
select="species_name"/></a></td>
      .
      .
      </xsl:for-each>

Here is a fragment of the XML:

<fieldguide>
  <account> 
     <species_name>Octodiceras fontanum</species_name>
     <file_link>../accounts/mosses/Octodiceras
fontanum_DMT.pdf</file_link>
     .
     .        
  </account>
</fieldguide>


As you can see, I am trying to construct an html link from 
the filename and path held in the <file_link> element.

This works fine when I call the stylesheet in-line or from 
Javascript in Internet Explorer, but when I run it with the 
PHP XSL extension, it generates a warning: Xsl:variable 
content should be empty since select is present. It's only a 
warning and the output is still as expected, but clearly I'm 
doing something wrong.

From reading up it seems to me this IS an xslt issue rather 
than a PHP one. I just don't understand it.

Glad of any help.

Alan Hale
Aberystwyth
Wales



      

--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.446 / Virus Database: 268.18.25/745 - Release Date:
03/04/2007 12:48
 


--~------------------------------------------------------------------
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>
--~--



--~------------------------------------------------------------------
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>