xsl-list
[Top] [All Lists]

Re: doubt

2005-04-07 05:47:14
Would you need something like..

XML file (I have added 1 more question):
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="test.xsl"?>
<questions>
<question  correctid="3" Qno="1" >
    <stmt1 mgif1="" mgif="" misc="" >Kepler's first
law of planetary 
motion  is also called </stmt1>
    <stmt2 mgif1="" mgif="" misc="" />
    <opt mgif1="" mgif="" voiceover="" >law of
periods</opt>
    <opt mgif1="" mgif="" voiceover="" >law of
areas</opt>
    <opt mgif1="" mgif="" voiceover="" >law of
orbits</opt>
    <opt mgif1="" mgif="" voiceover="" >law of
distances</opt>
</question>
<question  correctid="4" Qno="2" >
    <stmt1 mgif1="" mgif="" misc="" >question2</stmt1>
    <stmt2 mgif1="" mgif="" misc="" />
    <opt mgif1="" mgif="" voiceover="" >answer1</opt>
    <opt mgif1="" mgif="" voiceover="" >answer2</opt>
    <opt mgif1="" mgif="" voiceover="" >answer3</opt>
    <opt mgif1="" mgif="" voiceover="" >answer4</opt>
</question>
</questions>

XSLT file (file test.xsl):
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:output method="html" />

<xsl:template match="/questions">
  <html>
    <head>
      <title/>
    </head>
    <body>
      <table>
        <xsl:for-each select="question">
          <tr>
            <td>
              <b><xsl:value-of select="stmt1" /></b>
            </td>
          </tr> 
          <xsl:for-each select="opt">
            <tr>
              <td> 
                <xsl:if test="../@correctid =
position()">
                  <font color="green"><xsl:value-of
select="position()" /> . <xsl:value-of select="."
/></font>
                </xsl:if>
                <xsl:if test="not(../@correctid =
position())">         
                  <xsl:value-of select="position()" /> .
<xsl:value-of select="." />           
               </xsl:if>
              </td>
            </tr> 
          </xsl:for-each>
        </xsl:for-each>
      </table>
    </body> 
  </html>
</xsl:template>

</xsl:stylesheet>

Please open the XML file in browser(I tested with IE
6), and tell if this does the desired thing..?

I guess you want to show XML in browser, and want to
invoke browser's XSLT processor using xml-stylesheet
PI..

Regards,
Mukul

--- T UmaShankari <umashankari(_at_)lantana(_dot_)tenet(_dot_)res(_dot_)in>
wrote:


Hello,

    I am having the xml file in this format.

<question  correctid="3" Qno="370" >
    <stmt1 mgif1="" mgif="" misc="" >Kepler's first
law of planetary motion  is also called </stmt1>
    <stmt2 mgif1="" mgif="" misc="" />
    <opt mgif1="" mgif="" voiceover="" >law of
periods</opt>
    <opt mgif1="" mgif="" voiceover="" >law of
areas</opt>
    <opt mgif1="" mgif="" voiceover="" >law of
orbits</opt>
    <opt mgif1="" mgif="" voiceover="" >law of
distances</opt>
   </question>


For example, If the correct id number value is 3 the
law of orbits value 
should appear in different color. so according the
correct id the color of 
the option should get changed. Is it possible to do
?

Regards,
Uma



--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




                
__________________________________ 
Do you Yahoo!? 
Make Yahoo! your home page 
http://www.yahoo.com/r/hs

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>