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]

Use of Parameter with conditional logic - please help!


Hello, 

I have an XML document which contains multiple news headlines. Each headline
also as an associated story as in: 

<News>
<FullStory>
  <BaseSymbol>SP</BaseSymbol> 
  <HeadLines>Equity futures end firmer but again fail to maintain intraday
highs</HeadLines> 
  <Story>Equity futures ended Wednesdays session higher, but in a carbon
copy of Tuesdays trade, reversed the days major gains and closed near
opening levels. Futures shook off mostly weak economic data this morning,
focusing instead on a research note out of Merrill Lynch, which hinted at a
nadir for the semiconductor sector.</Story> 
</FullStory>
</News>

I have created an XSL doc which makes an HTML document for displaying the
headlines as so: 

 <xsl:for-each select="News/FullStory">
      <LI><A>
         <xsl:attribute name="HREF">headline.asp?storyid=<xsl:value-of
select="BaseSymbol"/>
         </xsl:attribute>
         <xsl:value-of select="HeadLines"/>
      </A></LI>
      </xsl:for-each>

This works fine. 

I have figured out MSXML2.XSLTemplate and how to pass the BaseSymbol
parameter of the headline selected to the second XSL file for displaying the
full story associated (via BaseSymbol) with the headline. My problem is that
I don't know how to work with the parameter. I can display it in HTML so I
know the second XSL file is receiving the parameter. So far my second XSL
looks like this:

<xsl:param name="basesym"/> 
  <xsl:template match="/">
    <HTML>
       The parameter value was: <xsl:value-of select="$basesym"/>
    <xsl:for-each select="News/FullStory">
       	<xsl:choose>
          <xsl:when test="[BaseSymbol=<xsl:value-of select="$comsym"/>">
                <xsl:value-of select="Story"/>
          </xsl:when>
                 <xsl:otherwise>
                   ......
                 </xsl:otherwise>
               </xsl:choose>
   </xsl:for-each>


The parameter value is displayed correctly but I can't get the conditional
logic to work.  I have tried many things including the use of variables. I
think I just need the syntax for the <xsl:choose> that can use the
parameter. Any suggestions are appreciated, I have been up all night and
leave for vacation today, I promised my boss this would be done.

Thanks in advance. `


 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]