xsl-list
[Top] [All Lists]

cannot include global level variables

2003-08-20 19:20:16
I'd like to include a xsl, which contains a url link. Somehow, it does not 
work. 
Here is my code 
in A.xsl: 
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0"
  xmlns:xalan="http://xml.apache.org/xslt";
  xmlns:name="http://blue.com/eng/arch/dna/name/";
  xmlns:bo="http://blue.com/eng/arch/dna/bo/";
  xmlns:dna="http://blue.com/eng/arch/dna/type/";>
<xsl:output method="xml" omit-xml-declaration="yes" />

<xsl:import href="config/bp/xsl/url.xsl" />

<xsl:template match="/dna:dna">
...
    <tr>
    <td width="324" align="right"><img>
    <xsl:attribute name="src"><xsl:copy-of select="$url" 
/>?BARCODE=<xsl:value-of 
select="bo:USER_ACCOUNT/name:customerNum"/>&amp;BAR_HEIGHT=.5&amp;FONT_COLOR=WHITE&amp;WIDTH=100</xsl:attribute>
    <xsl:attribute name="height">50</xsl:attribute>
    <xsl:attribute name="width">100</xsl:attribute>
    </img></td>
    </tr>
...
</xsl:template> 


and in "url.xsl", I have: 
<xsl:variable name="url"> 
<xsl:text>//localhost:7019/servlet/barCode</xsl:text> 
</xsl:variable> 
With this code, I got error:
file:///C:/clienteling/; Line -1; Column -1; VariableReference given for 
variable out of context or
without definition!  Name = url

If I replace the <xsl:include ...> with the actual code in url.xsl, then it 
worked.  I did make sure that the "href" points to the right file.

Is it because the way I am writing the url.xsl file?

Any suggestions are appreciated.

Thanks,

Shining

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



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