|
Myers Brigg Implemented with XLST
by Jelks Cabaniss jelks@jelks.nu
Parsing an ASCII file ala:
is a process improved considerably
by XML as this replacement example written with XLST demonstrates.
You need MSXML3. The May
version was released yesterday: http://msdn.microsoft.com/downloads/webtechnology/xml/msxml.asp
Click on the link that says "Download the May 2000 MSXML Technology Preview
Release" (don't bother with the SDK from the other link). It will
download a file called "msxmlwr.exe", a self-extracting archive.
Right-click on it and extract the files into a temp folder. From that temp
folder, run "xmlinst.exe". Reboot. That will allow XSLT 1.0
stylesheets to run (replacing the old MS-XSL preview in IE5).
mbxml.asp is the main script.
Simple enough.
filename=/learn/test/mbxml.asp
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>mbxml.asp</title>
<style type="text/css"><!--
@media screen, projection {
body { font-family: verdana, sans-serif; margin: 2% 5%; }
h1 { font: 2.3em garamond, georgia, serif; color: maroon; }
p { font-size: .9em; margin-left: 2em; color: navy; }
}
--></style>
</head>
<body>
<h1>Myer-Briggs Test</h1>
<form method="post" action="mbrespond.asp">
<%
Call ShowTest("mb.xml","mb.xsl")
Function ShowTest(strXML,strStyleSheet)
Set objXML = CreateObject("MSXML.DOMDocument")
Set objXSL = CreateObject("MSXML.DOMDocument")
objXML.load(Server.MapPath(strXML))
objXSL.load(Server.MapPath(strStyleSheet))
Response.Write objXML.transformNode (objXSL)
Set objXML = Nothing
Set objXSL = Nothing
End Function
%>
<p><input type="submit" value="Check Scores!" /></p>
</form>
</body>
</html>
mb.xsl is the style
sheet to style the questionare.
filename=/learn/test/mb.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="xml" indent="yes"
omit-xml-declaration="yes" />
<xsl:template match="/">
<xsl:for-each select="/questionairre/item">
<xsl:variable name="Pos" select="position()" />
<xsl:variable name="Num" select="concat('Q',$Pos)" />
<p><xsl:value-of select="concat($Pos,'. ', question)" />
—<br /><br />
<input type="radio" name="{$Num}" value="U"
checked="checked" />Undecided<br />
<xsl:for-each select="answer">
<input type="radio" name="{$Num}" value="{@code}" />
<xsl:value-of select="." /><br />
</xsl:for-each>
</p>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
mb.xml is the data that
powers the questionare.
filename=/learn/test/mb.xml
<?xml version="1.0"?>
<questionairre type="MB">
<item>
<question>At a party do you</question>
<answer code="E">interact with many, including strangers</answer>
<answer code="I">interact with a few, known to you</answer>
</item>
<item>
<question>Are you more</question>
<answer code="S">realistic than speculative</answer>
<answer code="N">speculative than realistic</answer>
</item>
<item>
<question>It is worse to</question>
<answer code="S">have your "head in the clouds"</answer>
<answer code="N">be "in a rut"</answer>
</item>
<item>
<question>Are you more impressed by</question>
<answer code="T">principles</answer>
<answer code="F">emotions</answer>
</item>
<item>
<question>Are you more drawn toward the</question>
<answer code="T">convincing</answer>
<answer code="F">touching</answer>
</item>
<item>
<question>Do you prefer to work</question>
<answer code="J">to deadlines</answer>
<answer code="P">just "whatever"</answer>
</item>
<item>
<question>Do you tend to choose</question>
<answer code="J">rather carefully</answer>
<answer code="P">somewhat impulsively</answer>
</item>
<item>
<question>At parties do you</question>
<answer code="E">stay late, with increasing energy</answer>
<answer code="I">leave early, with decreased energy</answer>
</item>
<item>
<question>Are you more attracted to</question>
<answer code="S">sensible people</answer>
<answer code="N">imaginative people</answer>
</item>
<item>
<question>Are you more interested in</question>
<answer code="S">what is actual</answer>
<answer code="N">what is possible</answer>
</item>
<item>
<question>In judging others are you more swayed by</question>
<answer code="T">laws than circumstances</answer>
<answer code="F">circumstances than laws</answer>
</item>
<item>
<question>In approaching others is your inclination to be</question>
<answer code="T">objective</answer>
<answer code="F">personal</answer>
</item>
<item>
<question>Are you more</question>
<answer code="J">punctual</answer>
<answer code="P">leisurely</answer>
</item>
<item>
<question>Does it bother you more having things</question>
<answer code="J">incomplete</answer>
<answer code="P">completed</answer>
</item>
<item>
<question>In your social groups do you</question>
<answer code="E">keep abreast of other's happenings</answer>
<answer code="I">get behind on the news</answer>
</item>
<item>
<question>In doing ordinary things are your more likely to</question>
<answer code="S">do it the usual way</answer>
<answer code="N">do it your own way</answer>
</item>
<item>
<question>Writers should</question>
<answer code="S">say what they mean and mean what they say</answer>
<answer code="N">express things more by use of analogy</answer>
</item>
<item>
<question>Which appeals to you more</question>
<answer code="T">consistency of thought</answer>
<answer code="F">harmonious human relationships</answer>
</item>
<item>
<question>Are you more comfortable in making</question>
<answer code="T">logical judgments</answer>
<answer code="F">value judgmants</answer>
</item>
<item>
<question>Do you want things</question>
<answer code="J">settled and decided</answer>
<answer code="P">unsettled and undecided</answer>
</item>
<item>
<question>Would you say you are more</question>
<answer code="J">serious and determined</answer>
<answer code="P">easy-going</answer>
</item>
<item>
<question>In phoning do you</question>
<answer code="E">rarely question that it will all be said</answer>
<answer code="I">rehearse what you'll say</answer>
</item>
<item>
<question>Facts</question>
<answer code="S">speak for themselves</answer>
<answer code="N">illustrate principles</answer>
</item>
<item>
<question>Are visionaries</question>
<answer code="S">somewhat annoying</answer>
<answer code="N">rather fascinating</answer>
</item>
<item>
<question>Are you more often</question>
<answer code="T">a cool-headed person</answer>
<answer code="F">a warm-hearted person</answer>
</item>
<item>
<question>Is it worse to be</question>
<answer code="T">unjust</answer>
<answer code="F">merciless</answer>
</item>
<item>
<question>Should one usually let events occur</question>
<answer code="J">by careful selection and choice</answer>
<answer code="P">randomly and by chance</answer>
</item>
<item>
<question>Do you feel better about</question>
<answer code="J">having purchased</answer>
<answer code="P">having the option to buy</answer>
</item>
<item>
<question>In company do you</question>
<answer code="E">initiate conversation</answer>
<answer code="I">wait to be approached</answer>
</item>
<item>
<question>Common sense is</question>
<answer code="S">rarely questionable</answer>
<answer code="N">frequently questionable</answer>
</item>
<item>
<question>Children often do not</question>
<answer code="S">make themselves useful enough</answer>
<answer code="N">exercise their fantasy enough</answer>
</item>
<item>
<question>In making decisions do you feel more comfortable with</question>
<answer code="T">standards</answer>
<answer code="F">feelings</answer>
</item>
<item>
<question>Are you more</question>
<answer code="T">firm than gentle</answer>
<answer code="F">gentle than firm</answer>
</item>
<item>
<question>Which is more admirable</question>
<answer code="J">the ability to organize and be methodical</answer>
<answer code="P">the ability to adapt and make do</answer>
</item>
<item>
<question>Do you put more value on the</question>
<answer code="J">definite</answer>
<answer code="P">open-ended</answer>
</item>
<item>
<question>Does new and non routine interaction with others</question>
<answer code="E">stimulate and energize you</answer>
<answer code="I">tax your reserves</answer>
</item>
<item>
<question>Are you more frequently</question>
<answer code="S">a practical sort of person</answer>
<answer code="N">a fanciful sort of person</answer>
</item>
<item>
<question>Are you more likely to</question>
<answer code="S">see how others are useful</answer>
<answer code="N">see how others see</answer>
</item>
<item>
<question>Which is more satisfying</question>
<answer code="T">to discuss an issue thoroughly</answer>
<answer code="F">to arrive at agreement on an issue</answer>
</item>
<item>
<question>Which rules you more</question>
<answer code="T">your head</answer>
<answer code="F">your heart</answer>
</item>
<item>
<question>Are you more comfortable with work that is</question>
<answer code="J">contracted</answer>
<answer code="P">done on a casual basis</answer>
</item>
<item>
<question>Do you tend to look for</question>
<answer code="J">the orderly</answer>
<answer code="P">whatever turns up</answer>
</item>
<item>
<question>Do you prefer</question>
<answer code="E">many friends with brief contact</answer>
<answer code="I">a few friends with more lengthy contact</answer>
</item>
<item>
<question>Do you go more by</question>
<answer code="S">facts</answer>
<answer code="N">principles</answer>
</item>
<item>
<question>Are you more interested in</question>
<answer code="S">production and distribution</answer>
<answer code="N">design and research</answer>
</item>
<item>
<question>Which is more of a compliment</question>
<answer code="T">There is a very logical person.</answer>
<answer code="F">There is a very sentimental person.</answer>
</item>
<item>
<question>Do you value in yourself more that you are</question>
<answer code="T">unwavering</answer>
<answer code="F">devoted</answer>
</item>
<item>
<question>Do you more often prefer the</question>
<answer code="J">final and unalterable statement</answer>
<answer code="P">tentative and preliminary statement</answer>
</item>
<item>
<question>Are you more comfortable</question>
<answer code="J">after a decision</answer>
<answer code="P">before a decision</answer>
</item>
<item>
<question>Do you</question>
<answer code="E">speak easily and length with strangers</answer>
<answer code="I">find little to say to strangers</answer>
</item>
<item>
<question>Are you more likely to trust your</question>
<answer code="S">experience</answer>
<answer code="N">hunch</answer>
</item>
<item>
<question>Do you feel</question>
<answer code="S">more practical than ingenious</answer>
<answer code="N">more ingenious than practical</answer>
</item>
<item>
<question>Which person is more to be complimented</question>
<answer code="T">one of clear reason</answer>
<answer code="F">strong feeling</answer>
</item>
<item>
<question>Are you inclined more to be</question>
<answer code="T">fair minded</answer>
<answer code="F">sysmpathetic</answer>
</item>
<item>
<question>Is it preferable mostly to</question>
<answer code="J">make sure things are arranged</answer>
<answer code="P">just let things happen</answer>
</item>
<item>
<question>In relationships should most things to</question>
<answer code="J">renegotiable</answer>
<answer code="P">random and circumstantial</answer>
</item>
<item>
<question>When the phone rings do you</question>
<answer code="E">hasten to get to it first</answer>
<answer code="I">hope someone else will answer</answer>
</item>
<item>
<question>Do you prize more in yourself</question>
<answer code="S">a strong sense of reality</answer>
<answer code="N">a vivid imagination</answer>
</item>
<item>
<question>Are you drawn more to</question>
<answer code="S">fundamentals</answer>
<answer code="N">overtones</answer>
</item>
<item>
<question>Which seems the greater error</question>
<answer code="T">to be too passionate</answer>
<answer code="F">to be too objective</answer>
</item>
<item>
<question>Do you see yourself as basically</question>
<answer code="J">the structured and scheduled</answer>
<answer code="P">the unstructured and unscheduled</answer>
</item>
<item>
<question>Are you a person that is more</question>
<answer code="J">routinized than whimsical</answer>
<answer code="P">whimsical than routinized</answer>
</item>
<item>
<question>Are you inclined to be</question>
<answer code="E">easy to approach</answer>
<answer code="I">somewhat reserved</answer>
</item>
<item>
<question>In writings do you prefer</question>
<answer code="S">the more literal</answer>
<answer code="N">the more figurative</answer>
</item>
<item>
<question>Is it harder for you to</question>
<answer code="S">identify with others</answer>
<answer code="N">utilize others</answer>
</item>
<item>
<question>Which do you wish more for yourself</question>
<answer code="T">clarity of reason</answer>
<answer code="F">strength of compassion</answer>
</item>
<item>
<question>Which is the greater fault</question>
<answer code="T">being indiscriminate</answer>
<answer code="F">being critical</answer>
</item>
<item>
<question>Do you prefer the</question>
<answer code="E">planned event</answer>
<answer code="I">unplanned event</answer>
</item>
<item>
<question>Do you tend to be more</question>
<answer code="J">deliberate than spontaneous</answer>
<answer code="P">spontaneous than deliberate</answer>
</item>
</questionairre>
|