Subject: Re: [xsl] doubt From: Mukul Gandhi <mukul_gandhi@xxxxxxxxx> Date: Thu, 7 Apr 2005 05:47:14 -0700 (PDT) |
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@xxxxxxxxxxxxxxxxxxxx> 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 > > __________________________________ Do you Yahoo!? Make Yahoo! your home page http://www.yahoo.com/r/hs
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] doubt, Aron Bock | Thread | [xsl] xml,browser and server, shaygan shayganp |
Re: [xsl] Pass a variable value fro, Colin Paul Adams | Date | [xsl] For-each sequence, Andrew Welch |
Month |