Skip to content
Snippets Groups Projects
Commit b48ac721 authored by Frank Steinberg's avatar Frank Steinberg
Browse files

Restructured multi-paragraph descriptions. Other minor changes.

parent 7bbce523
No related branches found
No related tags found
No related merge requests found
default: bjcp-2015-styleguide-orig.xml orig
default: bjcp-2015-styleguide-orig.xml orig bjcp-2015-styleguide-de.xml
cache/2015_Guidelines_Beer.docx:
if [ ! -d cache ] ; then mkdir cache ; fi
......@@ -9,12 +9,15 @@ cache/bjcp-2015-styleguide-word.xml: cache/2015_Guidelines_Beer.docx
unzip -p cache/2015_Guidelines_Beer.docx word/document.xml | xmllint --format - > cache/bjcp-2015-styleguide-word.xml
bjcp-2015-styleguide-orig.xml: cache/bjcp-2015-styleguide-word.xml xsl/bjcp-2015-styleguide-doc-to-xml.xsl
xsltproc xsl/bjcp-2015-styleguide-doc-to-xml.xsl cache/bjcp-2015-styleguide-word.xml | xmllint --format - > bjcp-2015-styleguide-orig.xml
xsltproc xsl/bjcp-2015-styleguide-doc-to-xml.xsl cache/bjcp-2015-styleguide-word.xml > bjcp-2015-styleguide-orig.xml
orig: bjcp-2015-styleguide-orig.xml xsl/bjcp-2015-styleguide-split.xsl
if [ ! -d orig ] ; then mkdir orig ; fi
xsltproc xsl/bjcp-2015-styleguide-split.xsl bjcp-2015-styleguide-orig.xml
bjcp-2015-styleguide-de.xml: orig xsl/bjcp-2015-styleguide-translate.xsl
xsltproc --stringparam lang de xsl/bjcp-2015-styleguide-translate.xsl bjcp-2015-styleguide-orig.xml > bjcp-2015-styleguide-de.xml
clean:
rm -rf cache orig
rm -f bjcp-2015-styleguide-orig.xml
......
<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
......@@ -85,7 +82,7 @@
</xsl:element>
</xsl:if>
<xsl:apply-templates select="following-sibling::w:p[1]" mode="style-intro"/>
<xsl:call-template name="style-intro"/>
<xsl:apply-templates select="following-sibling::w:p[1]" mode="attribute">
<xsl:with-param name="attribute">Entry Instructions</xsl:with-param>
......@@ -144,7 +141,7 @@
</xsl:element>
</xsl:if>
<xsl:apply-templates select="following-sibling::w:p[1]" mode="style-intro"/>
<xsl:call-template name="style-intro"/>
<xsl:apply-templates select="following-sibling::w:p[1]" mode="attribute">
<xsl:with-param name="attribute">Overall Impression</xsl:with-param>
......@@ -506,20 +503,33 @@
<xsl:template match="w:p" mode="style-intro">
<xsl:template name="style-intro">
<xsl:variable name="nodeset">
<xsl:apply-templates select="following-sibling::w:p[1]" mode="style-intro-recur"/>
</xsl:variable>
<xsl:if test="string-length($nodeset) >= 1">
<xsl:element name="description">
<xsl:apply-templates select="following-sibling::w:p[1]" mode="style-intro-recur"/>
</xsl:element>
</xsl:if>
</xsl:template>
<xsl:template match="w:p" mode="style-intro-recur">
<xsl:if test="not(w:pPr/w:pStyle/@w:val='Heading1') and not(w:pPr/w:pStyle/@w:val='Heading2') and not(w:pPr/w:pStyle/@w:val='Heading2first') and not(w:pPr/w:pStyle/@w:val='Heading3') and not(w:pPr/w:pStyle/@w:val='TOC2')">
<xsl:if test="((w:pPr/w:pStyle/@w:val = 'StyleIntro') or (w:pPr/w:pStyle/@w:val = 'StyleIntroLast')) and (not(w:r/w:t = 'Entry Instructions:'))">
<xsl:element name="description">
<xsl:element name="p">
<xsl:apply-templates select="w:r"/>
</xsl:element>
<xsl:if test="add-de">
<xsl:element name="description">
<xsl:element name="p">
<xsl:attribute name="lang">de</xsl:attribute>
<!-- translation to be entered here --><xsl:text> </xsl:text>
</xsl:element>
</xsl:if>
</xsl:if>
<xsl:apply-templates select="following-sibling::w:p[1]" mode="style-intro"/>
<xsl:apply-templates select="following-sibling::w:p[1]" mode="style-intro-recur"/>
</xsl:if>
</xsl:template>
......
<?xml version="1.0"?>
<xsl:stylesheet
version="1.0"
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
......@@ -15,6 +12,10 @@
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/styleguide">
<!--<xsl:apply-templates select="chapter"/>-->
<xsl:apply-templates select="category"/>
......
<?xml version="1.0"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common"
xmlns:str="http://exslt.org/strings"
xmlns:date="http://exslt.org/dates-and-times"
xmlns:dyn="http://exslt.org/dynamic"
extension-element-prefixes="exsl str dyn date">
<xsl:param name="lang">de</xsl:param>
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="*">
<xsl:element name="{local-name(.)}">
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="@*">
<xsl:copy>
<xsl:apply-templates select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="text()">
<xsl:variable name="d">
<xsl:value-of select="$lang"/>
<xsl:text>/</xsl:text>
<xsl:value-of select="../../@id"/>
<xsl:text>.xml</xsl:text>
</xsl:variable>
<xsl:value-of select="$d"/>
<xsl:choose>
<xsl:when test="document($d)">
<xsl:apply-templates select="document($d)/*"/>
</xsl:when>
<xsl:otherwise>
<xsl:copy>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment