I have the following XML
Expand|Select|Wrap|Line Numbers
- <AnswerList xmlns="http://tempuri.org/ALPS_Assessmentv1p1_RESCO_Schema.xsd">
- <DateTimeLastSaved>12:12:12 1900</DateTimeLastSaved>
- <UserName>Bob</UserName>
- <AssessmentName>Name of Assessment</AssessmentName>
- <AssessmentID>AssID</AssessmentID>
- <Sec_1_1189068258258>TEXT IN HERE</Sec_1_1189068258258>
- <Sec_2_1188555751625_MC0>1</Sec_2_1188555751625_MC0>
- <Sec_2_1188555751625_MC1>2</Sec_2_1188555751625_MC1>
- <Sec_2_1188555751625_MC2>3</Sec_2_1188555751625_MC2>
- <Sec_2_1188555751625_MC3>4</Sec_2_1188555751625_MC3>
- <xSec_Sec_1>Step 2 of 8 - What happened?</xSec_Sec_1>
- <xSec_Sec_2>Step 4 of 8 Assessor feedback</xSec_Sec_2>
- </AnswerList>
Expand|Select|Wrap|Line Numbers
- <?xml version="1.0" encoding="utf-8" ?>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <!-- Declare the output doctype -->
- <!--xsl:output method="xml" indent="yes" doctype-system="ims_qtiresv1p2.dtd"></xsl:output -->
- <xsl:template match="/">
- <qti_result_report>
- <result>
- <!-- Get the date that the assessment was submitted on -->
- <xsl:variable name="DateSubmitted">
- <xsl:value-of select="DateTimeLastSaved" />
- </xsl:variable>
- <!-- Get the Username of the user submitting the document -->
- <xsl:variable name="UserName">
- <xsl:value-of select="UserName" />
- </xsl:variable>
- <!-- Get the date that the assessment was submitted on -->
- <xsl:variable name="AssessmentName">
- <xsl:value-of select="AssessmentName" />
- </xsl:variable>
- <!-- Populate the Context -->
- <xsl:element name="context">
- <xsl:element name="name">
- <xsl:value-of select="$UserName" />
- </xsl:element>
- <xsl:element name="generic_identifier">
- <xsl:element name="type_label">
- <xsl:text>Student Username</xsl:text>
- </xsl:element>
- <xsl:element name="identifier_string">
- <xsl:value-of select="$UserName"/>
- </xsl:element>
- </xsl:element>
- <xsl:element name="date">
- <xsl:element name="type_label">
- <xsl:text>Exam</xsl:text>
- </xsl:element>
- <xsl:element name="datetime">
- <xsl:value-of select="$DateSubmitted"/>
- </xsl:element>
- </xsl:element>
- </xsl:element>
- <!-- Details about the assessment -->
- <xsl:element name="assessment_result">
- <xsl:attribute name="asi_title">
- <xsl:value-of select="AssessmentName"/>
- </xsl:attribute>
- <xsl:attribute name="ident_ref">
- <xsl:value-of select="AssessmentID"/>
- </xsl:attribute>
- </xsl:element>
- <!-- End of populate the Context -->
- <xsl:for-each select=".">
- <xsl:variable name="elem">
- <xsl:value-of select="name()"/>
- </xsl:variable>
- <xsl:variable name="elem_sub">
- <xsl:value-of select="substring($elem,1,4)"/>
- </xsl:variable>
- <xsl:if test="$elem_sub='xSec_'">
- <xsl:element name="section_result_title">
- <xsl:attribute name="asi_title">
- <xsl:value-of select="current()"/>
- </xsl:attribute>
- </xsl:element>
- </xsl:if>
- </xsl:for-each>
- </result>
- </qti_result_report>
- </xsl:template>
- </xsl:stylesheet>
If I do <xsl:template match="AnswerList"> to start with it will fire off the template lower down the XSL but with NO values in it.... I can not figure out what position I am at in the code.
If i do
Expand|Select|Wrap|Line Numbers
- <xsl:for-each select="child::node()">
- <xsl:for-each select="child::node()">
- <TEST />
As far as I can tell the XML is valid (Created in VS2005 according to a schema).
I have had this before hbut was able to get a work-around looping through the code with "for-each"s but that is not appropriate in this case.
I really need help here folks, as this project is already behind schedule and the customer is NOT happy! :S
Thanks very much,
Mark McGookin