This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Changing Attributes Based on Ancestry


Hi,

you want to something like:

<xsl:variable name="navColor">
<xsl:choose>
   <xsl:when test='ancestor::top_bar'>
      <xsl:text>#ffffff</xsl:text>
   </xsl:when>
   <xsl:otherwise>
      <xsl:text>#000000</xsl:text>
   </xsl:otherwise>
<xsl:choose>
</xsl:variable>

best,
-Rob


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>
>
>  <xsl:template name="bottom_bar">
>    <xsl:apply-templates select="document('./nav.xml')"/>
>  </xsl:template>
>
>  <xsl:template match="navigate">
>    <xsl:if test='ancestor::top_bar'>
>      <xsl:param name="navColor">#ffffff</xsl:param>
>    </xsl:if>
>    <xsl:if test='ancestor::bottom_bar'>
>      <xsl:param name="navColor">#000000</xsl:param>
>    </xsl:if>
>
>    <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:choose>
>        <xsl:when test="position() == last()">
>        </xsl:when>
>        <xsl:otherwise>
>          <span style="color:{$navColor}"><xsl:text> | </xsl:text></span>
>        </xsl:otherwise>
>      </xsl:choose>
>    </xsl:for-each>
>  </xsl:template>
>
>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?)
>
>eric
>
>
> XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
>




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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]