GitBucket
4.21.2
Toggle navigation
Snippets
Sign in
Files
Branches
1
Releases
1
Issues
Pull requests
Labels
Priorities
Milestones
Wiki
Forks
nigel.stanger
/
XML
Browse code
- Switched "naked" newlines to calls to newline-internal.
master
1 parent
93ef22b
commit
d166981fdfe8a405029ae429bd1871b9729cfaaa
nstanger
authored
on 22 Feb 2012
Patch
Showing
1 changed file
modules/q-and-a.xml
Ignore Space
Show notes
View
modules/q-and-a.xml
<?xml version="1.0" encoding="utf-8"?> <!-- Elements for generating question and sample answer text in the likes of tutorial and lab exercises. --> <stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- Question text. This only exists so that we can ensure that appropriate <p> tags are correctly inserted. If this template didn't exist, showing the answers would generate invalid HTML. The answers are enclosed in a <div class="answer">...</div>. Without this template, the answer markup ends up embedded inside <p>...</p>, which is invalid. --> <template name="question" match="question"> <common formats="/latex/xelatex/"><xsl:apply-templates /></common> <common formats="/html/xhtml/"> <xsl:choose> <!-- Check whether there are actual paragraphs inside the question. If so, let them worry about inserting the <p> tags. --> <xsl:when test="count(paragraph|para|p|question|answer|code-block) != 0"> <xsl:apply-templates /> </xsl:when> <!-- Otherwise, insert <p> tags surrounding the question content. --> <xsl:otherwise> <p><xsl:apply-templates /></p> </xsl:otherwise> </xsl:choose> </common> </template> <!-- Sample answers, which may optionally be excluded from the output. This can be done globally for all answers by setting the style sheet parameter $showanswers to "no", or it can be done locally on a question-by-question basis by setting the @hide attribute of the element to "yes". @hide: If "yes", don't include this answer in the output stream. The default is to include the answer. --> <template name="answer" match="answer"> <common formats="/latex/xelatex/"> <!-- It's nice to weed out the sample answer markup at the XSLT processing stage to make LaTeX run faster. Note that \showanswers still needs to be called so that LaTeX can format chapter headings like "Answers for ..." --> <xsl:if test="$showanswers='yes'"> <xsl:text>\begin{answer}</xsl:text> <xsl:call-template name="newline-internal" /> <xsl:apply-templates /> <xsl:text>\end{answer}</xsl:text> <xsl:call-template name="newline-internal" /> <xsl:call-template name="newline-internal" /> </xsl:if> </common> <common formats="/html/xhtml/"> <xsl:if test="$showanswers='yes'"> <div class="answer"> <xsl:apply-templates /> </div> </xsl:if> </common> </template> <!-- Match hidden answers and do nothing. --> <template name="hidden-answer" match="answer[@hide='yes']" /> </stylesheet>
<?xml version="1.0" encoding="utf-8"?> <!-- Elements for generating question and sample answer text in the likes of tutorial and lab exercises. --> <stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <!-- Question text. This only exists so that we can ensure that appropriate <p> tags are correctly inserted. If this template didn't exist, showing the answers would generate invalid HTML. The answers are enclosed in a <div class="answer">...</div>. Without this template, the answer markup ends up embedded inside <p>...</p>, which is invalid. --> <template name="question" match="question"> <common formats="/latex/xelatex/"><xsl:apply-templates /></common> <common formats="/html/xhtml/"> <xsl:choose> <!-- Check whether there are actual paragraphs inside the question. If so, let them worry about inserting the <p> tags. --> <xsl:when test="count(paragraph|para|p|question|answer|code-block) != 0"> <xsl:apply-templates /> </xsl:when> <!-- Otherwise, insert <p> tags surrounding the question content. --> <xsl:otherwise> <p><xsl:apply-templates /></p> </xsl:otherwise> </xsl:choose> </common> </template> <!-- Sample answers, which may optionally be excluded from the output. This can be done globally for all answers by setting the style sheet parameter $showanswers to "no", or it can be done locally on a question-by-question basis by setting the @hide attribute of the element to "yes". @hide: If "yes", don't include this answer in the output stream. The default is to include the answer. --> <template name="answer" match="answer"> <common formats="/latex/xelatex/"> <!-- It's nice to weed out the sample answer markup at the XSLT processing stage to make LaTeX run faster. Note that \showanswers still needs to be called so that LaTeX can format chapter headings like "Answers for ..." --> <xsl:if test="$showanswers='yes'"> <xsl:text>\begin{answer} </xsl:text> <xsl:apply-templates /> <xsl:text>\end{answer} </xsl:text> </xsl:if> </common> <common formats="/html/xhtml/"> <xsl:if test="$showanswers='yes'"> <div class="answer"> <xsl:apply-templates /> </div> </xsl:if> </common> </template> <!-- Match hidden answers and do nothing. --> <template name="hidden-answer" match="answer[@hide='yes']" /> </stylesheet>
Show line notes below