ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> xsl-list
xsl-list
[xsl] Different templates for same set of nodes
by SHEIKH Sajjad other posts by this author
Dec 11 2003 1:38PM messages near this date
Re: [xsl] how to estimate speed of a transformation | Re: [xsl] Different templates for same set of nodes
Hi all,

I am having a little issue in using the same template for two different
purposes.

Following sheet produces first the header of the page as following

You are here Entropresse > >> KFC >>> 1. Question Dossiers >>> E -
110803GTO nama LK213 environmental chick (2001 18)

2nd template produces the HREF as following

<a href="http://localhost?value1=Entorpresse&value2=KFC&value3=1.
Questions Dossiers&value4=E - 110803GTO nama LK213 environmental chick
(2001 18)">  click here </a>

I don't know how can I differentiate between two to use them in
different locations.

Any suggestion?



----------------------------- my.xsl ------------------------------

<xsl:template match="link"> 
<table> 
 <tr> 
  <td> You are here:&#160;&#160;</td>

  <xsl:for-each select="location"> 
	 <td> 
  	 <a>  
   	  <xsl:attribute name="href"> 
		<xsl:value-of
select="@path"/> xmlinterlinks1.html</xsl:attribute>
    		<xsl:value-of select="."/> 
  		<xsl:if
test="position()!=last()"> &#160;>>>&#160;</xsl:if>
  	 </a> 
  </xsl:for-each> 
 </tr> 
</table> 
</xsl:template> 

<xsl:template match="link"> 
<a> 
<xsl:attribute name="href"> 
  <xsl:text> http://localhost?</xsl:text>
 <xsl:for-each select="location"> 
  <xsl:text> value</xsl:text>
  <xsl:value-of select="position()"/> 
  <xsl:text> =</xsl:text>
  <xsl:value-of select="."/> 
  <xsl:if test="position()!=last()"> &amp;</xsl:if>
 </xsl:for-each> 
</xsl:attribute> 
<xsl:value-of select="."/> 
</a> 
</xsl:template> 


----------------------------- my.xml------------------------------
<?xml version="1.0" encoding="ISO-8859-1"?>  
 <link> 
  <location path="..\..\..\"> Entorpresse</location> 
  <location path="..\..\"> KFC</location> 
  <location path="..\"> 1. Questions Dossiers</location> 
  <location last="true" path=""> E - 110803GTO nama LK213 environmental
chick (2001 18)</location>  
 </link> 

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
Thread:
SHEIKH Sajjad
David Carlisle

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved