xsl-list
[Top] [All Lists]

Can i assign value to a variable and used it in different templat e

2004-09-20 22:41:15

Hi all
Thanks to all of your immediate response

I have the following template 

<xsl:template name="process-style">     
        <xsl:if test="normalize-space($name)='border' and self::table">
                <xsl:variable name="bordervalue" select='"$value"'/>
        </xsl:if>               
</xsl:template>

Actually i am used this template for processing inline style.(above is a
part of that).
name variable contains the attribute name present in style attribute.My aim
is to
check whether the name is border,then i store it value to some variable.I
want to use 
this variable in  some other templates.

<xsl:template name="tablechildborder">
        <xsl:if test="number($bordervalue) &gt; 0 ">                    
                <xsl:attribute name="border-style">solid</xsl:attribute>
                <xsl:attribute name="border-separation">1pt</xsl:attribute>

                <xsl:attribute name="border-left-width">thin</xsl:attribute>
                <xsl:attribute
name="border-right-width">thin</xsl:attribute>
                <xsl:attribute name="border-width">thin</xsl:attribute>
        </xsl:if>
</xsl:template>

<xsl:template name="tableborder">
        <xsl:when test="number($bordervalue) &gt; 0 ">
                <xsl:attribute name="border">
                        <xsl:call-template name="createborder">
                                <xsl:with-param name="tborder"
select="$bordervalue"/>
                        </xsl:call-template>
                </xsl:attribute>
        </xsl:when>
</xsl:template>

I tried this one.But i could not get the $bordervalue inside tableborder and
tablechildborder template.First time it shown some error.Then i make the
variable bordervalue
as global.

<xsl:stylesheet 
  version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  xmlns:fo="http://www.w3.org/1999/XSL/Format";
  xmlns:fox="http://xml.apache.org/fop/extensions";>

<!-- ==============================================
        Global variable declaration
==================================================-->
<xsl:variable name="bordervalue"/>

// All my template present here

</xsl:stylesheet>


How can i solve this problem?Can i assign a value to variable and use it in
other template.
Please help me.


Thanks in advance

George



**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



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