Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

xslt - How we import the value in one xsl into another xsl in XSLT1.0

I have below xsl created Address1.xsl

<?xml version="1.0" encoding="UTF-8" ?>
    <xsl:stylesheet version="1.0">
    <xsl:param name="FCode"/>
      <xsl:param name="FName"/>
       <xsl:template match="/">
       <xsl:call-template name="Addtemplate"/>
       </xsl:template>
         <xsl:template name=" Addtemplate ">
  <xsl:variable name="TownType">
  <xsl:if test="$FCode!= ''">
        <xsl:value-of select="ABCValue"/>
          </xsl:if>
    </xsl:variable>
<Add>
     <addName>
      <xsl:value-of select="$TownName"/>
      </addName>
      <addType>
                 <xsl:value-of select="$TownType"/>
               </addType>
  </Add>
   </xsl:template>
</xsl:stylesheet>

In the second xsl Address2.xsl I want to import the value of addName.Tried below xsl but not getting the value.

Address2.xsl

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0">
<xsl:import href=" Address1.xsl "/>
<xsl:template match="/ ">
   
   <xsl:variable name="TempVar">
    <xsl:copy>
      <xsl:call-template name="Addtemplate">
         <xsl:value-of select=' addName'/>**<!--  I want addName value in the Address1.xsl to be mapped to TempVar variable  -->**
            
      </xsl:call-template>
    </xsl:copy>
    </xsl:variable>
   </xsl:template>
</xsl:stylesheet>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...