[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Changing Attributes Based on Ancestry

Subject: Re: Changing Attributes Based on Ancestry
From: Robert Koberg <rob@xxxxxxxxxx>
Date: Wed, 31 Dec 1969 20:09:29 -0800
elem ancestry

you want to something like:

<xsl:variable name="navColor">
  <xsl:when test='ancestor::top_bar'>


eric wrote:

Hi.  I saw in a post a bit ago a similar subject, and I tried to apply it,
but it didn't seem to work.  What am I missing?

Here is the XSL:

 <xsl:template name="top_bar">
   <xsl:apply-templates select="document('./nav.xml')"/>

 <xsl:template name="bottom_bar">
   <xsl:apply-templates select="document('./nav.xml')"/>

 <xsl:template match="navigate">
   <xsl:if test='ancestor::top_bar'>
     <xsl:param name="navColor">#ffffff</xsl:param>
   <xsl:if test='ancestor::bottom_bar'>
     <xsl:param name="navColor">#000000</xsl:param>

   <xsl:value-of select="$navColor"/>
   <xsl:for-each select="lnk">
     <a href="{@href}" style="color:{$navColor};
font-size:9pt"><xsl:value-of select="."/></a>
       <xsl:when test="position() == last()">
         <span style="color:{$navColor}"><xsl:text> | </xsl:text></span>

Basically, I want the color for the top_bar to be white and the bottom bar
to be black, but it's not applying.  I also tried using:  <xsl:template
match="//navigate">  but that didn't work either.  Thanks for the help.

(is it not working because it's importing from an outside file?)


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

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

Current Thread


Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
First Name
Last Name
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.