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: using mode-values within a template


Hi Tom,

thanks for your suggestion to do this by hard-coding the mode name into the templates as a variable like

 <xsl:template match="foo" mode="bar">
     <xsl:variable name="mode" select="'bar'"/>

It's not the most elegant way but it works!

--------------------------------------------------------

Besides this i got two more serious problems and I would be glad to get an opinion by somebody knowing a solution:

1. How can I select all nodes of a certain type except the one that is used at the moment??

e.g.:
  
<xsl:for-each select="//project">
 <a href="{normalize-space(translate(@name,' ',''))}{@version}_cp.html">
   <xsl:value-of select="@name"/>
   <xsl:value-of select="@version"/>
  </a>
   &#160;&#160;&#160;&#160;&#160;
 </xsl:for-each> 

I want to create a link for each project in the xml-source except the project I'm currently expanding...maybe it gets simpler, when I tell you, that all the projects are siblings....but I haven't read anything about a general element siblings (only preceding- and following-siblings) in xpath!!


2. Another bad problem I have when creating some more links. After processing the following lines:

 <xsl:variable name="online_doc" select="docu[@kind='url']"/>
 
......

<xsl:choose>
 <xsl:when test="$online_doc">
  <a href="http://{$online_doc}";>
   <xsl:value-of select="$online_doc"/>
  </a>
 </xsl:when>
 <xsl:otherwise>
  <xsl:text>&#160;</xsl:text>
 </xsl:otherwise>
</xsl:choose>


with the following xml-source:

...
 <docu kind="url" loc="internet">
  www.gcc.com
 </docu>
...   


my href has the following value:

http://%0A       www.gcc.com%0A/


Does anybody know, what I can make better to avoid this rubbish result???

Many thanks in advance,

Stefan Greim

 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]