Skip to content

Instantly share code, notes, and snippets.

@memowe
Last active December 18, 2019 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save memowe/80653c4f1362d450a31536e52bafc366 to your computer and use it in GitHub Desktop.
Save memowe/80653c4f1362d450a31536e52bafc366 to your computer and use it in GitHub Desktop.
eXiStentiaLisT test resources
<?xml version="1.0"?>
<qa>
<question lang="en">What is the answer to the ultimate question of life, the universe, and everything?</question>
<question lang="de">Wie lautet die antwort auf die Frage nach dem Leben, dem Universum und dem ganzen Rest?</question>
<answer>42</answer>
</qa>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="xs"
version="2.0">
<xsl:template match="emph">
<i>
<xsl:value-of select="."/>
</i>
</xsl:template>
</xsl:stylesheet>
<?xml version="1.0"?>
<xsl:stylesheet version="3.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" encoding="UTF-8" html-version="5" media-type="text/html" omit-xml-declaration="yes"/>
<xsl:param name="lang">en</xsl:param>
<xsl:template match="/">
<html lang="{$lang}">
<head>
<title>Q &amp; A</title>
</head>
<body>
<h1>Q &amp; A</h1>
<xsl:apply-templates select="qa/question[@lang eq $lang]"/>
<br/>
<xsl:apply-templates select="qa/answer"/>
</body>
</html>
</xsl:template>
<xsl:template match="question[@lang eq 'en']">
<strong>Question</strong>: <xsl:value-of select="."/>
</xsl:template>
<xsl:template match="question[@lang eq 'de']">
<strong>Frage</strong>: <xsl:value-of select="."/>
</xsl:template>
<xsl:template match="answer">
<xsl:choose>
<xsl:when test="$lang eq 'en'"><strong>Answer</strong>: </xsl:when>
<xsl:when test="$lang eq 'de'"><strong>Antwort</strong>: </xsl:when>
</xsl:choose>
<xsl:value-of select="."/>
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment