Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 11th, 2009, 11:46 AM
Authorized User
 
Join Date: Apr 2008
Posts: 85
Thanks: 10
Thanked 0 Times in 0 Posts
Default

I am using saxon 6.5.

Is there any other way so I can achieve the same without using Tunnel parameter ?

Thanks

Nelly
 
Old November 11th, 2009, 11:55 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Just upgrade to XSLT 2.0 and Saxon 9.2. If you're using Java then there's no possible reason to be sticking with XSLT 1.0 - version 2.0 has been out for nearly three years.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old November 11th, 2009, 11:58 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

You can achieve the same with normal parameters by passing the parameter on with each apply-templates and with each template involved. If you have e.g.
Code:
<root foo="bar">
  <child>
     <grandchild/>
  </child>
</root>
then you would need e.g.
Code:
<xsl:template match="root">
  <xsl:apply-templates select="*">
     <xsl:with-param name="p1" select="@foo"/>
  </xsl:apply-templates>
</xsl:template>

<xsl:template match="child">
  <xsl:param name="p1"/>
  ...
  <xsl:apply-templates select="*">
     <xsl:with-param name="p1" select="$p1"/>
  </xsl:apply-templates>
  ...
</xsl:template>

<xsl:template match="grandchild">
  <xsl:param name="p1"/> 
  ...
  <xsl:if test="$p1 = 'bar'">
    ...
  </xsl:if>
</xsl:template>
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old November 11th, 2009, 12:58 PM
Authorized User
 
Join Date: Apr 2008
Posts: 85
Thanks: 10
Thanked 0 Times in 0 Posts
Default

I am using Saxon 6.5, is there any other way instead of using Tunnel parameter.
 
Old November 11th, 2009, 01:23 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Quote:
Originally Posted by nelly78 View Post
I am using Saxon 6.5, is there any other way instead of using Tunnel parameter.
You have already asked that, and I did already answer that in Problem with template. That code uses normal parameters, not tunnel parameters, you simply then have to ensure that all templates pass on and receive the parameter(s) you need.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with template Hari7 XSLT 3 November 3rd, 2009 01:26 PM
Problem with XSLT template nelly78 XML 3 October 29th, 2009 02:14 PM
Problem in Recursive applying template ismomo XSLT 3 December 29th, 2007 11:35 PM
xsl:template problem mickhughes XSLT 1 August 16th, 2007 08:40 AM
Datagrid template column problem lore6673 ASP.NET 1.x and 2.0 Application Design 1 December 3rd, 2003 11:05 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.