Commits

Shlomi Fish committed 0f9b91f

More progress.

Comments (0)

Files changed (2)

src/tutorials/bad-elements/perl-elements-to-avoid.xml-grammar-vered.xml

 <?xml version="1.0" encoding="utf-8"?>
-<document xmlns="http://www.shlomifish.org/open-source/projects/XML-Grammar/Vered/" xmlns:xlink="http://www.w3.org/1999/xlink" version="0.2.0">
+<document xmlns="http://www.shlomifish.org/open-source/projects/XML-Grammar/Vered/" xmlns:xlink="http://www.w3.org/1999/xlink" version="0.2.0" xml:lang="en-GB">
 <info>
 <title>Perl Elements to Avoid</title>
 </info>

src/tutorials/bad-elements/vered-xml-to-docbook.xslt

                 <xsl:value-of select="vrd:info/vrd:title" />
             </db:title>
         </db:info>
+        <xsl:apply-templates select="vrd:body/vrd:preface" />
         <xsl:apply-templates select="vrd:body/vrd:section" />
     </article>
 </xsl:template>
 
+<xsl:template match="vrd:preface">
+    <db:preface>
+        <xsl:copy-of select="@xml:id" />
+        <xsl:if test="@xml:lang">
+            <xsl:copy-of select="@xml:lang" />
+        </xsl:if>
+        <db:info>
+            <db:title>
+                <xsl:choose>
+                    <xsl:when test="vrd:info/vrd:title">
+                        <xsl:value-of select="vrd:info/vrd:title" />
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:value-of select="@xml:id" />
+                    </xsl:otherwise>
+                </xsl:choose>
+            </db:title>
+        </db:info>
+    </db:preface>
+</xsl:template>
+
 <xsl:template match="vrd:section">
     <section>
         <xsl:copy-of select="@xml:id" />