Topic: xsl variable Pages that link to <a href="https://ozoneasylum.com/backlink?for=25186" title="Pages that link to Topic: xsl variable" rel="nofollow" >Topic: xsl variable\

 
Author Thread
conny
Obsessive-Compulsive (I) Inmate

From:
Insane since: Mar 2005

IP logged posted posted 03-05-2005 08:38 Edit Quote

I'm doing a project on E-Quiz.
I've declared a variable but how can i let the user choose the topic he/she wants and display the question out?
I was asked to display the question in an ASP.
I'm not sure whether I have did the correct thing.


<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="ISO-8859-1"/>

<xsl:template match="/">

<xsl:variable name="concept" select="0" />
<xsl:variable name="topic" select="0" />
<xsl:variable name="level" select="0" />
<xsl:variable name="question" select="0" />


<table border="1">
<tr><xsl:for-each select="entry">
<td>
Concept = <xsl:value-of select="$concept" /><br />
Topic = <xsl:value-of select="$topic" /><br />
Level = <xsl:value-of select="$level" /><br />
Question = <xsl:value-of select="$question" /><br />
<xsl:if test="$concept = 1">

<xsl:value-of select="concept1" /><br />

</xsl:if>

<xsl:if test="$concept = 2">

<xsl:value-of select="concept2" /><br />

</xsl:if>

<xsl:if test="$topic = 1">

<xsl:value-of select="topic1" /><br />

</xsl:if>

<xsl:if test="$topic = 2">

<xsl:value-of select="topic2" /><br />

</xsl:if>

</td></xsl:for-each>
</tr>
</table>



</xsl:template>

</xsl:stylesheet>

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

IP logged posted posted 03-05-2005 13:29 Edit Quote

It'd help if you provided the XML file too. For improved legibility try to indent them correctly. It really help to spot common errors.
When posting some code/markup it's better to put them between the [ code ] and [ /code ] UBB tags, or to give a link to them if they are too long.

My first guess, but I'm rusty with XSLT, is that you should replace the $ by some @ in your XSL.
If you want to pass some variables to your XSL you must put some <xsl:param name="idOfParameter" /> right after the <xsl:output ... />. I don't know for ASP, but in PHP when you do an XLSTransformation you can pass an array of parameters which are interpreted and used thanks to the <xsl:param name="idOfParameter" /> in the XSL.

Hope that helps,

[edit] Doh! I really dislike the syntax which require to specify the namespace on each tag. And it generate some undesired slimies on the Asylum :p [/edit]



(Edited by poi on 03-05-2005 13:35)



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu