Intermediate XML schema
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema elementFormDefault="qualified" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Questions">
<xsd:annotation>
<xsd:documentation>Questions element contains the questions for the current page</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:choice minOccurs="0" maxOccurs="unbounded">
<xsd:element ref="Question" />
</xsd:choice>
</xsd:complexType>
</xsd:element>
<xsd:element name="Question">
<xsd:annotation>
<xsd:documentation>The Question element is used to represent a question in the interview</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Style" minOccurs="0" />
<xsd:element name="Label" type="Label" minOccurs="0" />
<xsd:element name="Error" type="Label" minOccurs="0" maxOccurs="unbounded" />
<xsd:element ref="Table" minOccurs="0" />
<xsd:element ref="Questions" minOccurs="0" />
<xsd:element ref="Control" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Table">
<xsd:annotation>
<xsd:documentation>The definition of a question table</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Row" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="Summary" type="xsd:string" use="optional" />
<xsd:attribute name="UseTablesLayout" type="xsd:boolean" use="optional" />
</xsd:complexType>
</xsd:element>
<xsd:element name="Row">
<xsd:annotation>
<xsd:documentation>The defintion of a table row</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Cell" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="Y" type="xsd:long" use="optional" />
</xsd:complexType>
</xsd:element>
<xsd:element name="Cell">
<xsd:annotation>
<xsd:documentation>The definition of a table cell</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Label" type="Label" minOccurs="0" />
<xsd:element name="Error" type="Label" minOccurs="0" maxOccurs="unbounded" />
<xsd:element ref="Control" minOccurs="0" maxOccurs="unbounded" />
<xsd:element ref="Table" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="X" type="xsd:long" use="required" />
<xsd:attribute name="Y" type="xsd:long" use="required" />
<xsd:attribute name="Class" type="xsd:string" use="optional" />
</xsd:complexType>
</xsd:element>
<xsd:element name="Control">
<xsd:annotation>
<xsd:documentation>The definition of a question control</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element ref="Style" minOccurs="0" />
<xsd:element ref="Category" minOccurs="0" maxOccurs="unbounded" />
</xsd:sequence>
<xsd:attribute name="Type" type="ControlTypes" use="required" />
<xsd:attribute name="QuestionName" type="xsd:string" use="required" />
<xsd:attribute name="ElementID" type="xsd:string" use="optional" />
<xsd:attribute name="Value" type="xsd:string" use="optional" />
<xsd:attribute name="Length" type="xsd:long" use="optional" />
</xsd:complexType>
</xsd:element>
<xsd:element name="Category">
<xsd:annotation>
<xsd:documentation>The defintion of a control category</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Label" type="Label" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="Name" type="xsd:string" use="required" />
<xsd:attribute name="CategoryID" type="xsd:string" use="required" />
<xsd:attribute name="Checked" type="xsd:string" use="optional" />
</xsd:complexType>
</xsd:element>
<xsd:complexType name="Label">
<xsd:annotation>
<xsd:documentation>A element type which is used to set a label for questions, banners, errors, and navigation controls</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element ref="Style" />
<xsd:element name="Text" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="Style">
<xsd:annotation>
<xsd:documentation>The Style element is used to set presentation styles for Question element</xsd:documentation>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Control" minOccurs="0">
<xsd:complexType>
<xsd:attribute name="Type" type="ControlTypes" use="optional" />
<xsd:attribute name="ReadOnly" type="xsd:boolean" use="optional" />
<xsd:attribute name="Accelerator" type="xsd:long" use="optional" />
</xsd:complexType>
</xsd:element>
<xsd:element name="Cell" minOccurs="0">
<xsd:complexType>
<xsd:attribute name="Width" type="xsd:string" use="optional">
</xsd:attribute>
<xsd:attribute name="Height" type="xsd:string" use="optional">
</xsd:attribute>
<xsd:attribute name="BgColor" type="xsd:string" use="optional">
</xsd:attribute>
<xsd:attribute name="BorderColor" type="xsd:string" use="optional">
</xsd:attribute>
<xsd:attribute name="BorderLeftColor" type="xsd:string" use="optional">
</xsd:attribute>
<xsd:attribute name="BorderRightColor" type="xsd:string" use="optional">
</xsd:attribute>
<xsd:attribute name="BorderTopColor" type="xsd:string" use="optional">
</xsd:attribute>
<xsd:attribute name="BorderBottomColor" type="xsd:string" use="optional">
</xsd:attribute>
<xsd:attribute name="BorderStyle" type="BorderStyles" use="optional">
</xsd:attribute>
<xsd:attribute name="BorderLeftStyle" type="BorderStyles" use="optional">
</xsd:attribute>
<xsd:attribute name="BorderRightStyle" type="BorderStyles" use="optional">
</xsd:attribute>
<xsd:attribute name="BorderTopStyle" type="BorderStyles" use="optional">
</xsd:attribute>
<xsd:attribute name="BorderBottomStyle" type="BorderStyles" use="optional">
</xsd:attribute>
<xsd:attribute name="BorderWidth" type="xsd:long" use="optional">
</xsd:attribute>
<xsd:attribute name="BorderLeftWidth" type="xsd:long" use="optional">
</xsd:attribute>
<xsd:attribute name="BorderRightWidth" type="xsd:long" use="optional">
</xsd:attribute>
<xsd:attribute name="BorderTopWidth" type="xsd:long" use="optional">
</xsd:attribute>
<xsd:attribute name="BorderBottomWidth" type="xsd:long" use="optional">
</xsd:attribute>
<xsd:attribute name="Padding" type="xsd:long" use="optional">
</xsd:attribute>
<xsd:attribute name="PaddingLeft" type="xsd:long" use="optional">
</xsd:attribute>
<xsd:attribute name="PaddingRight" type="xsd:long" use="optional">
</xsd:attribute>
<xsd:attribute name="PaddingTop" type="xsd:long" use="optional">
</xsd:attribute>
<xsd:attribute name="PaddingBottom" type="xsd:long" use="optional">
</xsd:attribute>
<xsd:attribute name="Wrap" type="xsd:boolean" use="optional">
</xsd:attribute>
<xsd:attribute name="ColSpan" type="xsd:long" use="optional">
</xsd:attribute>
<xsd:attribute name="RowSpan" type="xsd:long" use="optional">
</xsd:attribute>
<xsd:attribute name="RepeatHeader" type="xsd:long" use="optional">
</xsd:attribute>
<xsd:attribute name="RepeatSideHeader">
</xsd:attribute>
</xsd:complexType>
</xsd:element>
<xsd:element name="Font" minOccurs="0">
<xsd:complexType>
<xsd:attribute name="Family" type="xsd:string" use="optional" />
<xsd:attribute name="Size" type="xsd:long" use="optional" />
<xsd:attribute name="IsUnderline" type="xsd:boolean" use="optional" />
<xsd:attribute name="IsItalic" type="xsd:boolean" use="optional" />
<xsd:attribute name="IsBold" type="xsd:boolean" use="optional" />
<xsd:attribute name="IsStrikethrough" type="xsd:boolean" use="optional" />
<xsd:attribute name="IsOverline" type="xsd:boolean" use="optional" />
<xsd:attribute name="IsBlink" type="xsd:boolean" use="optional" />
<xsd:attribute name="IsSuperScript" type="xsd:boolean" use="optional" />
<xsd:attribute name="IsSubscript" type="xsd:boolean" use="optional" />
</xsd:complexType>
</xsd:element>
<xsd:element name="Audio" minOccurs="0">
<xsd:complexType>
<xsd:attribute name="Name" type="xsd:string">
</xsd:attribute>
<xsd:attribute name="PlayControlPosition" type="AudioControlPositions">
</xsd:attribute>
<xsd:attribute name="RecordControlPosition" type="AudioControlPositions">
</xsd:attribute>
<xsd:attribute name="Record" type="RecordModes">
</xsd:attribute>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
<xsd:attribute name="Color" type="xsd:string" use="optional" />
<xsd:attribute name="BgColor" type="xsd:string" use="optional" />
<xsd:attribute name="Hidden" type="xsd:boolean" use="optional" />
<xsd:attribute name="Align" type="Alignments" use="optional" />
<xsd:attribute name="VerticalAlign" type="VerticalAlignments" use="optional" />
<xsd:attribute name="ElementAlign" type="ElementAlignments" use="optional" />
<xsd:attribute name="Orientation" type="Orientations" use="optional" />
<xsd:attribute name="Indent" type="xsd:long" use="optional" />
<xsd:attribute name="ZIndex" type="xsd:long" use="optional" />
<xsd:attribute name="Cursor" type="CursorStyles" use="optional" />
<xsd:attribute name="Image" type="xsd:string" use="optional" />
<xsd:attribute name="ImagePosition" type="ImagePositions" use="optional" />
<xsd:attribute name="Rows" type="xsd:long" use="optional" />
<xsd:attribute name="Columns" type="xsd:long" use="optional" />
<xsd:attribute name="Width" type="xsd:string" use="optional" />
<xsd:attribute name="Height" type="xsd:string" use="optional" />
</xsd:complexType>
</xsd:element>
<xsd:simpleType name="Alignments">
<xsd:annotation>
<xsd:documentation>Constant values for alignment in styles</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="AlignLeft" />
<xsd:enumeration value="AlignCenter" />
<xsd:enumeration value="AlignRight" />
<xsd:enumeration value="AlignJustify" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="CursorStyles">
<xsd:annotation>
<xsd:documentation>Constant values for different cursor types</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Auto" />
<xsd:enumeration value="CrossHair" />
<xsd:enumeration value="Default" />
<xsd:enumeration value="Hand" />
<xsd:enumeration value="Move" />
<xsd:enumeration value="EResize" />
<xsd:enumeration value="NEResize" />
<xsd:enumeration value="NResize" />
<xsd:enumeration value="NWResize" />
<xsd:enumeration value="WResize" />
<xsd:enumeration value="SWResize" />
<xsd:enumeration value="SResize" />
<xsd:enumeration value="SEResize" />
<xsd:enumeration value="Text" />
<xsd:enumeration value="Wait" />
<xsd:enumeration value="Help" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="BorderStyles">
<xsd:annotation>
<xsd:documentation>Constant values for different types of borders</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="None" />
<xsd:enumeration value="Solid" />
<xsd:enumeration value="Double" />
<xsd:enumeration value="Groove" />
<xsd:enumeration value="Ridge" />
<xsd:enumeration value="Inset" />
<xsd:enumeration value="Outset" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="ControlTypes">
<xsd:annotation>
<xsd:documentation>Constant values for different types of borders</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Static" />
<xsd:enumeration value="Edit" />
<xsd:enumeration value="SingleLineEdit"/>
<xsd:enumeration value="MultiLineEdit"/>
<xsd:enumeration value="DropList" />
<xsd:enumeration value="ComboList" />
<xsd:enumeration value="RadioButton" />
<xsd:enumeration value="CheckButton" />
<xsd:enumeration value="ListBox" />
<xsd:enumeration value="ListControl" />
<xsd:enumeration value="Button" />
<xsd:enumeration value="Date" />
<xsd:enumeration value="Time" />
<xsd:enumeration value="DateTime" />
<xsd:enumeration value="Password" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="CategoryTypes">
<xsd:annotation>
<xsd:documentation>Constant values for alignment in styles</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Category" />
<xsd:enumeration value="CategoryList" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="QuestionTypes">
<xsd:annotation>
<xsd:documentation>Constant values for alignment in styles</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Simple" />
<xsd:enumeration value="LoopCategorical" />
<xsd:enumeration value="LoopNumeric" />
<xsd:enumeration value="Compound" />
<xsd:enumeration value="Block" />
<xsd:enumeration value="Page" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="Orientations">
<xsd:annotation>
<xsd:documentation>Constant values for orientation in styles</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Column" />
<xsd:enumeration value="Row" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="VerticalAlignments">
<xsd:annotation>
<xsd:documentation>Constant values for vertical alignment in styles</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Baseline" />
<xsd:enumeration value="Middle" />
<xsd:enumeration value="Sub" />
<xsd:enumeration value="Super" />
<xsd:enumeration value="TextTop" />
<xsd:enumeration value="TextBottom" />
<xsd:enumeration value="Top" />
<xsd:enumeration value="Bottom" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="ElementAlignments">
<xsd:annotation>
<xsd:documentation>Constant values for element alignment in styles</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Default" />
<xsd:enumeration value="Left" />
<xsd:enumeration value="NewLine" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="ImagePositions">
<xsd:annotation>
<xsd:documentation>Constant values for an image position</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Only" />
<xsd:enumeration value="Left" />
<xsd:enumeration value="Right" />
<xsd:enumeration value="Top" />
<xsd:enumeration value="Bottom" />
<xsd:enumeration value="None" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="AudioControlPositions">
<xsd:annotation>
<xsd:documentation>Constant values for audio control position</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="Left" />
<xsd:enumeration value="Right" />
<xsd:enumeration value="Top" />
<xsd:enumeration value="Bottom" />
</xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="RecordModes">
<xsd:annotation>
<xsd:documentation>Constant values for audio record mode</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string">
<xsd:enumeration value="None" />
<xsd:enumeration value="Manual" />
<xsd:enumeration value="Auto" />
<xsd:enumeration value="AutoNoControls" />
<xsd:enumeration value="Prohibited" />
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
See
See also
Custom Question.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="xml" indent="yes"/>
<xsl:param name="bIncludeCSSStyles" select="true()"/>
<xsl:param name="bIncludeElementIds" select="true()"/>
<xsl:param name="sImageLocation"/>
<xsl:param name="bShowOnly" select="false()"/>
<xsl:param name="bAutoComplete" select="true()"/>
<xsl:template match="/">
<xsl:apply-templates/>
</xsl:template>
<xsl:template match="Questions">
<Question>
<xsl:apply-templates select="Question"/>
</Question>
</xsl:template>
<xsl:template match="Question">
<xsl:param name="bWithinTable" select="false()"/>
<xsl:if test="Style/@ElementAlign = 'NewLine'">
<br/>
</xsl:if>
<xsl:for-each select="*">
<xsl:choose>
<xsl:when test="name() = 'Control'">
<xsl:apply-templates select="."/>
</xsl:when>
<xsl:when test="name() = 'Label'">
<xsl:apply-templates select=".">
<xsl:with-param name="sLabelClass" select="'mrQuestionText'"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="name() = 'Error'">
<xsl:apply-templates select=".">
<xsl:with-param name="sLabelClass" select="'mrErrorText'"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="name() = 'Table'">
<xsl:apply-templates select="."/>
</xsl:when>
<xsl:when test="name() = 'Questions'">
<xsl:apply-templates/>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:template>
<xsl:template match="Label | Error">
<xsl:param name="sLabelClass" select="'UNKNOWN'"/>
<xsl:param name="bWithinTable" select="false()"/>
<xsl:choose>
<xsl:when test="$bIncludeElementIds and @ElementId != ''">
<xsl:element name="label">
<xsl:attribute name="for">
<xsl:value-of select="@ElementId"/>
</xsl:attribute>
<xsl:call-template name="LabelBase">
<xsl:with-param name="sLabelClass" select="$sLabelClass"/>
<xsl:with-param name="bWithinTable" select="$bWithinTable"/>
</xsl:call-template>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="LabelBase">
<xsl:with-param name="sLabelClass" select="$sLabelClass"/>
<xsl:with-param name="bWithinTable" select="$bWithinTable"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="LabelBase">
<xsl:param name="sLabelClass" select="'UNKNOWN'"/>
<xsl:param name="bWithinTable" select="false()"/>
<xsl:if test="Style/@ElementAlign = 'NewLine'">
<br/>
</xsl:if>
<xsl:call-template name="Label"/>
</xsl:template>
<xsl:template name="Label">
<xsl:choose>
<xsl:when test="Style/@Image != ''">
<xsl:choose>
<xsl:when test="Style/@ImagePosition = 'Left' or not(Style/@ImagePosition)">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:if test="not((starts-with(Style/@Image, 'http:'))or(starts-with(Style/@Image, 'https:')))">
<xsl:value-of select="$sImageLocation"/>
</xsl:if>
<xsl:value-of select="Style/@Image"/>
</xsl:attribute>
<xsl:attribute name="alt"/>
</xsl:element>
<xsl:call-template name="LabelText"/>
</xsl:when>
<xsl:when test="Style/@ImagePosition = 'Right'">
<xsl:call-template name="LabelText"/>
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:if test="not((starts-with(Style/@Image, 'http:'))or(starts-with(Style/@Image, 'https:')))">
<xsl:value-of select="$sImageLocation"/>
</xsl:if>
<xsl:value-of select="Style/@Image"/>
</xsl:attribute>
<xsl:attribute name="alt"/>
</xsl:element>
</xsl:when>
<xsl:when test="Style/@ImagePosition = 'Top'">
<xsl:element name="div">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:if test="not((starts-with(Style/@Image, 'http:'))or(starts-with(Style/@Image, 'https:')))">
<xsl:value-of select="$sImageLocation"/>
</xsl:if>
<xsl:value-of select="Style/@Image"/>
</xsl:attribute>
<xsl:attribute name="alt"/>
</xsl:element>
</xsl:element>
<xsl:call-template name="LabelText"/>
</xsl:when>
<xsl:when test="Style/@ImagePosition = 'Bottom'">
<xsl:element name="div">
<xsl:call-template name="LabelText"/>
</xsl:element>
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:if test="not((starts-with(Style/@Image, 'http:'))or(starts-with(Style/@Image, 'https:')))">
<xsl:value-of select="$sImageLocation"/>
</xsl:if>
<xsl:value-of select="Style/@Image"/>
</xsl:attribute>
<xsl:attribute name="alt"/>
</xsl:element>
</xsl:when>
<xsl:when test="Style/@ImagePosition = 'ImageOnly'">
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:if test="not((starts-with(Style/@Image, 'http:'))or(starts-with(Style/@Image, 'https:')))">
<xsl:value-of select="$sImageLocation"/>
</xsl:if>
<xsl:value-of select="Style/@Image"/>
</xsl:attribute>
<xsl:attribute name="alt">
<xsl:value-of select="Text"/>
</xsl:attribute>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="LabelText"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="LabelText"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="LabelText">
<xsl:choose>
<xsl:when test="Text/@WellFormed = 'false'">
<xsl:value-of select="Text"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of disable-output-escaping = "yes" select="Text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--- TABLE -->
<xsl:template match="Table">
<xsl:element name="span">
<xsl:if test="$bIncludeCSSStyles">
<xsl:attribute name="class">mrQuestionTable</xsl:attribute>
</xsl:if>
<xsl:for-each select="parent::node()">
<xsl:attribute name="style">
<!---Ensure the list vertical-align-->
<xsl:text>display:block;</xsl:text>
<xsl:call-template name="TableStyle"/>
</xsl:attribute>
</xsl:for-each>
<xsl:call-template name="Row"/>
</xsl:element>
</xsl:template>
<!-- SPAN LAYOUT -->
<xsl:template name="Row">
<xsl:for-each select="Row">
<xsl:sort select="@Y" order="ascending" data-type="number"/>
<xsl:call-template name="Cell"/>
</xsl:for-each>
</xsl:template>
<xsl:template name="Cell">
<xsl:for-each select="Cell">
<xsl:sort select="@X" order="ascending" data-type="number" />
<xsl:for-each select="*">
<xsl:choose>
<xsl:when test="name() = 'Control'">
<xsl:apply-templates select="."/>
</xsl:when>
<xsl:when test="name() = 'Label'">
<xsl:apply-templates select=".">
<xsl:with-param name="sLabelClass" select="'mrQuestionText'"/>
<xsl:with-param name="bWithinTable" select="true()"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="name() = 'Error'">
<xsl:apply-templates select=".">
<xsl:with-param name="sLabelClass" select="'mrErrorText'"/>
<xsl:with-param name="bWithinTable" select="true()"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="name() = 'Table'">
<xsl:apply-templates select="."/>
</xsl:when>
<xsl:when test="name() = 'Question'">
<xsl:apply-templates select=".">
<xsl:with-param name="bWithinTable" select="true()"/>
</xsl:apply-templates>
</xsl:when>
</xsl:choose>
</xsl:for-each>
</xsl:for-each>
</xsl:template>
<!--- CONTROL -->
<xsl:template match="Control">
<xsl:if test="Style/@ElementAlign = 'NewLine'">
<br/>
</xsl:if>
<xsl:choose>
<xsl:when test="@Type = 'RadioButton'">
<xsl:call-template name="RadioButtonControl"/>
</xsl:when>
<xsl:when test="@Type = 'CheckButton'">
<xsl:call-template name="CheckButtonControl"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="StaticControl"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="StaticControl">
<xsl:element name="span">
<xsl:attribute name="style">
<xsl:if test="Style/@Width or Style/@Height">
<xsl:call-template name="SpanStyle"/>
</xsl:if>
<xsl:call-template name="ControlStyle"/>
</xsl:attribute>
<xsl:for-each select="Category">
<xsl:apply-templates select="Label">
<xsl:with-param name="sLabelClass" select="'mrShowText'"/>
</xsl:apply-templates>
</xsl:for-each>
</xsl:element>
</xsl:template>
<xsl:template name="RadioButtonControl">
<!--- Control Label -->
<xsl:element name="input">
<!--- Set Control Type -->
<xsl:attribute name="type">radio</xsl:attribute>
<!--- Input name -->
<xsl:attribute name="name">
<xsl:value-of select="@QuestionName"/>
</xsl:attribute>
<!--- ID -->
<xsl:if test="$bIncludeElementIds">
<xsl:attribute name="id">
<xsl:value-of select="@ElementID"/>
<xsl:if test="Category[1]/@CategoryID">
<xsl:value-of select="Category[1]/@CategoryID"/>
</xsl:if>
</xsl:attribute>
</xsl:if>
<!--- CSS Class -->
<xsl:if test="$bIncludeCSSStyles">
<xsl:attribute name="class">mrSingle</xsl:attribute>
</xsl:if>
<!--- Show Only -->
<xsl:if test="$bShowOnly != false()">
<xsl:attribute name="disabled"/>
</xsl:if>
<!--- Read Only -->
<xsl:if test="Style/Control/@ReadOnly = 'true'">
<xsl:attribute name="disabled"/>
</xsl:if>
<!--- Accelerator access key -->
<xsl:if test="Style/Control/@Accelerator != ''">
<xsl:attribute name="accesskey">
<xsl:value-of select="Style/Control/@Accelerator"/>
</xsl:attribute>
</xsl:if>
<!--- Set Control Style -->
<xsl:attribute name="style">
<xsl:call-template name="ControlStyle"/>
</xsl:attribute>
<!--- Button Category -->
<xsl:attribute name="value">
<xsl:if test="Category[1]/@Name">
<xsl:value-of select="Category[1]/@Name"/>
</xsl:if>
</xsl:attribute>
<!--- Is Button Checked -->
<xsl:if test="Category[1]/@Checked = 'true'">
<xsl:attribute name="checked"/>
</xsl:if>
<xsl:choose>
<xsl:when test="$bIncludeElementIds and Category[1]/Label">
<xsl:element name="label">
<xsl:attribute name="for">
<xsl:value-of select="@ElementID"/>
<xsl:if test="Category[1]/@CategoryID">
<xsl:value-of select="Category[1]/@CategoryID"/>
</xsl:if>
</xsl:attribute>
<xsl:apply-templates select="Category[1]/Label">
<xsl:with-param name="sLabelClass" select="'mrSingleText'"/>
</xsl:apply-templates>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="Category[1]/Label">
<xsl:with-param name="sLabelClass" select="'mrSingleText'"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:template>
<xsl:template name="CheckButtonControl">
<!--- Control Label -->
<xsl:element name="input">
<!--- Set Control Type -->
<xsl:attribute name="type">checkbox</xsl:attribute>
<!--- Input name -->
<xsl:attribute name="name">
<xsl:value-of select="@QuestionName"/>
<xsl:if test="Category[1]/@Name">
<xsl:value-of select="Category[1]/@Name"/>
</xsl:if>
</xsl:attribute>
<!--- ID -->
<xsl:if test="$bIncludeElementIds">
<xsl:attribute name="id">
<xsl:value-of select="@ElementID"/>
<xsl:if test="Category[1]/@CategoryID">
<xsl:value-of select="Category[1]/@CategoryID"/>
</xsl:if>
</xsl:attribute>
</xsl:if>
<!--- CSS Class -->
<xsl:if test="$bIncludeCSSStyles">
<xsl:attribute name="class">mrMultiple</xsl:attribute>
</xsl:if>
<!--- Show Only -->
<xsl:if test="$bShowOnly != false()">
<xsl:attribute name="disabled"/>
</xsl:if>
<!--- Read Only -->
<xsl:if test="Style/Control/@ReadOnly = 'true'">
<xsl:attribute name="disabled"/>
</xsl:if>
<!--- Accelerator access key -->
<xsl:if test="Style/Control/@Accelerator != ''">
<xsl:attribute name="accesskey">
<xsl:value-of select="Style/Control/@Accelerator"/>
</xsl:attribute>
</xsl:if>
<!--- Set Control Style -->
<xsl:attribute name="style">
<xsl:call-template name="ControlStyle"/>
</xsl:attribute>
<!--- Button Category -->
<xsl:attribute name="value">
<xsl:if test="Category[1]/@Name">
<xsl:value-of select="Category[1]/@Name"/>
</xsl:if>
</xsl:attribute>
<!--- Is Button Checked -->
<xsl:if test="Category[1]/@Checked = 'true'">
<xsl:attribute name="checked"/>
</xsl:if>
<xsl:choose>
<xsl:when test="$bIncludeElementIds and Category[1]/Label">
<xsl:element name="label">
<xsl:attribute name="for">
<xsl:value-of select="@ElementID"/>
<xsl:if test="Category[1]/@CategoryID">
<xsl:value-of select="Category[1]/@CategoryID"/>
</xsl:if>
</xsl:attribute>
<xsl:apply-templates select="Category[1]/Label">
<xsl:with-param name="sLabelClass" select="'mrMultipleText'"/>
</xsl:apply-templates>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates select="Category[1]/Label">
<xsl:with-param name="sLabelClass" select="'mrMultipleText'"/>
</xsl:apply-templates>
</xsl:otherwise>
</xsl:choose>
</xsl:element>
</xsl:template>
<!--- Style Templates -->
<xsl:template name="LabelStyle">
<!--- adds the label styles to a style attribute -->
<xsl:if test="Style/@BgColor">
background-color: <xsl:value-of select="Style/@BgColor"/>;
</xsl:if>
<xsl:if test="Style/@Color">
color: <xsl:value-of select="Style/@Color"/>;
</xsl:if>
<xsl:if test="Style/@Indent">
margin-left: <xsl:value-of select="Style/@Indent"/>em;
</xsl:if>
<xsl:if test="Style/@Width">
width: <xsl:value-of select="Style/@Width"/>;
</xsl:if>
<xsl:if test="Style/@Height">
height: <xsl:value-of select="Style/@Height"/>;
</xsl:if>
<xsl:if test="Style/@Hidden = 'true'">visibility: hidden;</xsl:if>
<xsl:if test="Style/@ZIndex">
z-index: <xsl:value-of select="Style/@ZIndex"/>;
</xsl:if>
<xsl:choose>
<xsl:when test="Style/@Cursor = 'EResize'">cursor: e-resize;</xsl:when>
<xsl:when test="Style/@Cursor = 'NEResize'">cursor: ne-resize;</xsl:when>
<xsl:when test="Style/@Cursor = 'NResize'">cursor: n-resize;</xsl:when>
<xsl:when test="Style/@Cursor = 'NWResize'">cursor: nw-resize;</xsl:when>
<xsl:when test="Style/@Cursor = 'WResize'">cursor: w-resize;</xsl:when>
<xsl:when test="Style/@Cursor = 'SWResize'">cursor: sw-resize;</xsl:when>
<xsl:when test="Style/@Cursor = 'SResize'">cursor: s-resize;</xsl:when>
<xsl:when test="Style/@Cursor = 'SEResize'">cursor: se-resize;</xsl:when>
<xsl:when test="Style/@Cursor">
cursor: <xsl:value-of select="Style/@Cursor"/>;
</xsl:when>
</xsl:choose>
<xsl:if test="Style/Cell/@Wrap = 'false'">white-space: nowrap;</xsl:if>
<xsl:if test="Style/Font/@Family">
font-family: <xsl:value-of select="Style/Font/@Family"/>;
</xsl:if>
<xsl:if test="Style/Font/@Size">
font-size: <xsl:value-of select="Style/Font/@Size"/>pt;
</xsl:if>
<xsl:if test="Style/Font/@IsUnderline = 'true'">text-decoration: underline;</xsl:if>
<xsl:if test="Style/Font/@IsItalic = 'true'">font-style: italic;</xsl:if>
<xsl:if test="Style/Font/@IsBold = 'true'">font-weight: bold;</xsl:if>
<xsl:if test="Style/Font/@IsStrikethrough = 'true'">text-decoration: line-through;</xsl:if>
<xsl:if test="Style/Font/@IsOverline = 'true'">text-decoration: overline;</xsl:if>
<xsl:if test="Style/Font/@IsBlink = 'true'">text-decoration: blink;</xsl:if>
<xsl:if test="Style/Font/@IsSubscript = 'true'">vertical-align: sub;</xsl:if>
<xsl:if test="Style/Font/@IsSuperscript = 'true'">vertical-align: super;</xsl:if>
</xsl:template>
<xsl:template name="SpanStyle">
<!--- adds span tag specific styles to a style attribute -->
<xsl:text>display: inline-block;</xsl:text>
</xsl:template>
<xsl:template name="ControlStyle">
<!--- adds the control styles to a style attribute -->
<xsl:call-template name="LabelStyle"/>
</xsl:template>
<xsl:template name="TableStyle">
<!--- adds the table styles to a style attribute -->
<xsl:call-template name="LabelStyle"/>
</xsl:template>
</xsl:stylesheet>
This sample transforms the
RadioButton and
CheckButton. See
Default XSL templates to add other control types. This sample does not set all styles (for example, cell style, Style.Orientation).
See also