These make it much easier to check the test reference data.
It's simpler to maintain these XSLT transformations together with easily
machine-processable XML files instead of trying to make the XML files
easy to read. Required regenerating the XML files to add references to
the style sheets. common-referencedata.xsl is duplicated in each
directory to make it work on more browser (at least Firefox).
Change-Id: I67de308a50831371d7c2581e2b013901006387e4
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<AnalysisData Name="InputData">
<DataFrame Name="Frame0">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<AnalysisData Name="InputData">
<DataFrame Name="Frame0">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<AnalysisData Name="InputData">
<DataFrame Name="Frame0">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<AnalysisData Name="InputData">
<DataFrame Name="Frame0">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<AnalysisData Name="InputData">
<DataFrame Name="Frame0">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<AnalysisData Name="InputData">
<DataFrame Name="Frame0">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<AnalysisData Name="InputData">
<DataFrame Name="Frame0">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<AnalysisData Name="InputData">
<DataFrame Name="Frame0">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<AnalysisData Name="InputData">
<DataFrame Name="Frame0">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<AnalysisData Name="InputData">
<DataFrame Name="Frame0">
--- /dev/null
+<?xml version="1.0"?>
+
+<!--
+This file is currently duplicated to each directory containing reference data
+XML files. This is to make it compatible with more browsers.
+If you modify one of these files, please keep others in sync.
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="/">
+ <html><body>
+ <xsl:apply-templates/>
+ </body></html>
+</xsl:template>
+
+<xsl:template match="/ReferenceData">
+ <h1>Test Reference Data</h1>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="Vector">
+ (<xsl:value-of select="*[@Name='X']"/>;
+ <xsl:value-of select="*[@Name='Y']"/>;
+ <xsl:value-of select="*[@Name='Z']"/>)
+</xsl:template>
+
+<xsl:template name="SequenceAsHorizontalTable">
+ <xsl:param name="root" select="."/>
+ <table border="1">
+ <tr><th>Count</th><th>Items</th></tr>
+ <tr>
+ <td><xsl:value-of select="$root/Int[@Name='Length']"/></td>
+ <td>
+ <xsl:call-template name="SequenceAsCSV">
+ <xsl:with-param name="root" select="$root"/>
+ </xsl:call-template>
+ </td>
+ </tr>
+ </table>
+</xsl:template>
+
+<xsl:template name="SequenceAsCSV">
+ <xsl:param name="root" select="."/>
+ <xsl:for-each select="$root/*[position() > 1]">
+ <xsl:apply-templates select="."/>
+ <xsl:if test="position() < last()">, </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+<xsl:template name="Bool">
+ <xsl:value-of select="."/>
+</xsl:template>
+
+<xsl:template name="String">
+ <xsl:value-of select="."/>
+</xsl:template>
+
+<xsl:template name="Int">
+ <xsl:value-of select="."/>
+</xsl:template>
+
+<xsl:template name="Real">
+ <xsl:value-of select="."/>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:import href="common-referencedata.xsl"/>
+
+<xsl:template match="AnalysisData">
+ <h2><xsl:value-of select="@Name"/></h2>
+ <table border="1">
+ <tr>
+ <th>Frame</th>
+ <th>X</th>
+ <th>Values</th>
+ </tr>
+ <xsl:for-each select="DataFrame/Sequence[@Name='Y']">
+ <tr>
+ <td><xsl:value-of select="../@Name"/></td>
+ <td><xsl:value-of select="../Real[@Name='X']"/></td>
+ <td><xsl:call-template name="SequenceAsCSV"/></td>
+ </tr>
+ </xsl:for-each>
+ </table>
+</xsl:template>
+
+<xsl:template match="DataValue">
+ <xsl:value-of select="Real[@Name='Value']"/>
+</xsl:template>
+
+</xsl:stylesheet>
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedVariable Name="Variable1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedVariable Name="Variable1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
<ReferenceData>
<ParsedSelections Name="Parsed">
<ParsedSelection Name="Selection1">
--- /dev/null
+<?xml version="1.0"?>
+
+<!--
+This file is currently duplicated to each directory containing reference data
+XML files. This is to make it compatible with more browsers.
+If you modify one of these files, please keep others in sync.
+-->
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="/">
+ <html><body>
+ <xsl:apply-templates/>
+ </body></html>
+</xsl:template>
+
+<xsl:template match="/ReferenceData">
+ <h1>Test Reference Data</h1>
+ <xsl:apply-templates/>
+</xsl:template>
+
+<xsl:template match="Vector">
+ (<xsl:value-of select="*[@Name='X']"/>;
+ <xsl:value-of select="*[@Name='Y']"/>;
+ <xsl:value-of select="*[@Name='Z']"/>)
+</xsl:template>
+
+<xsl:template name="SequenceAsHorizontalTable">
+ <xsl:param name="root" select="."/>
+ <table border="1">
+ <tr><th>Count</th><th>Items</th></tr>
+ <tr>
+ <td><xsl:value-of select="$root/Int[@Name='Length']"/></td>
+ <td>
+ <xsl:call-template name="SequenceAsCSV">
+ <xsl:with-param name="root" select="$root"/>
+ </xsl:call-template>
+ </td>
+ </tr>
+ </table>
+</xsl:template>
+
+<xsl:template name="SequenceAsCSV">
+ <xsl:param name="root" select="."/>
+ <xsl:for-each select="$root/*[position() > 1]">
+ <xsl:apply-templates select="."/>
+ <xsl:if test="position() < last()">, </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+<xsl:template name="Bool">
+ <xsl:value-of select="."/>
+</xsl:template>
+
+<xsl:template name="String">
+ <xsl:value-of select="."/>
+</xsl:template>
+
+<xsl:template name="Int">
+ <xsl:value-of select="."/>
+</xsl:template>
+
+<xsl:template name="Real">
+ <xsl:value-of select="."/>
+</xsl:template>
+
+</xsl:stylesheet>
--- /dev/null
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:import href="common-referencedata.xsl"/>
+
+<xsl:key name="SelectionName" match="ParsedSelections/ParsedSelection" use="@Name"/>
+
+<xsl:template match="ParsedSelections">
+ <h2>Parsed Selections</h2>
+ <table border="1">
+ <tr>
+ <th/>
+ <th>Input</th>
+ <th>Name</th>
+ <th>Text</th>
+ <th>Dynamic</th>
+ </tr>
+ <xsl:for-each select="*">
+ <tr>
+ <td><xsl:value-of select="@Name"/></td>
+ <td><xsl:value-of select="String[@Name='Input']"/></td>
+ <td><xsl:value-of select="String[@Name='Name']"/></td>
+ <td><xsl:value-of select="String[@Name='Text']"/></td>
+ <td><xsl:value-of select="Bool[@Name='Dynamic']"/></td>
+ </tr>
+ </xsl:for-each>
+ </table>
+</xsl:template>
+
+<xsl:template match="CompiledSelections">
+ <h2>Compiled Selections</h2>
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="EvaluatedSelections">
+ <h2>Evaluated for <xsl:value-of select="@Name"/></h2>
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="Selection">
+ <h3><xsl:value-of select="@Name"/></h3>
+ <p>
+ Selection text:<br/>
+ <xsl:value-of select="key('SelectionName', @Name)/String[@Name='Text']"/>
+ </p>
+ <xsl:apply-templates />
+</xsl:template>
+
+<xsl:template match="Selection/Sequence[@Name='Atoms']">
+ <p>
+ Atoms:
+ <xsl:call-template name="SequenceAsHorizontalTable"/>
+ </p>
+</xsl:template>
+
+<xsl:template match="Selection/Sequence[@Name='Positions']">
+ <p>
+ Positions (count: <xsl:value-of select="Int[@Name='Length']"/>):
+ <table border="1">
+ <tr>
+ <th>Atom count</th>
+ <th>Atoms</th>
+ <xsl:if test="Position/Vector[@Name='Coordinates']">
+ <th>Coordinates</th>
+ </xsl:if>
+ </tr>
+ <xsl:for-each select="Position">
+ <tr>
+ <td><xsl:value-of select="Sequence[@Name='Atoms']/Int[@Name='Length']"/></td>
+ <td>
+ <xsl:call-template name="SequenceAsCSV">
+ <xsl:with-param name="root" select="Sequence[@Name='Atoms']"/>
+ </xsl:call-template>
+ </td>
+ <xsl:if test="Vector[@Name='Coordinates']">
+ <td>
+ <xsl:apply-templates select="Vector[@Name='Coordinates']"/>
+ </td>
+ </xsl:if>
+ </tr>
+ </xsl:for-each>
+ </table>
+ </p>
+</xsl:template>
+
+</xsl:stylesheet>
{
public:
static const xmlChar * const cXmlVersion;
+ static const xmlChar * const cXmlStyleSheetNodeName;
+ static const xmlChar * const cXmlStyleSheetContent;
static const xmlChar * const cRootNodeName;
explicit Impl(ReferenceDataMode mode);
const xmlChar * const TestReferenceData::Impl::cXmlVersion =
(const xmlChar *)"1.0";
+const xmlChar * const TestReferenceData::Impl::cXmlStyleSheetNodeName =
+ (const xmlChar *)"xml-stylesheet";
+const xmlChar * const TestReferenceData::Impl::cXmlStyleSheetContent =
+ (const xmlChar *)"type=\"text/xsl\" href=\"referencedata.xsl\"";
const xmlChar * const TestReferenceData::Impl::cRootNodeName =
(const xmlChar *)"ReferenceData";
const xmlChar * const TestReferenceChecker::Impl::cBooleanNodeName =
_refDoc = xmlNewDoc(cXmlVersion);
xmlNodePtr rootNode = xmlNewDocNode(_refDoc, NULL, cRootNodeName, NULL);
xmlDocSetRootElement(_refDoc, rootNode);
+ xmlNodePtr xslNode = xmlNewDocPI(_refDoc, cXmlStyleSheetNodeName,
+ cXmlStyleSheetContent);
+ xmlAddPrevSibling(rootNode, xslNode);
}
else
{