mirror of
https://github.com/rust-lang/book.git
synced 2026-11-30 18:14:33 -06:00
Get chapter titles, body, and literals in text working
This commit is contained in:
+32
-2
@@ -1,11 +1,41 @@
|
||||
<?xml version="1.0"?>
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml">
|
||||
|
||||
<xsl:output method="text" />
|
||||
<xsl:strip-space elements="*" />
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="/w:document/w:body/*" />
|
||||
</xsl:template>
|
||||
|
||||
<!-- Ignore these -->
|
||||
<xsl:template match="w:p[starts-with(w:pPr/w:pStyle/@w:val, 'TOC')]" />
|
||||
<xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'ChapterStart']" />
|
||||
|
||||
<xsl:template match="w:p[w:pPr/w:pStyle/@w:val = 'ChapterTitle']">
|
||||
<xsl:text># </xsl:text>
|
||||
<xsl:value-of select="w:r/w:t" />
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="w:p[w:pPr/w:pStyle[@w:val = 'BodyFirst' or @w:val = 'Body']]">
|
||||
<xsl:apply-templates select="w:r" />
|
||||
<xsl:text> </xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="w:r[w:rPr/w:rStyle/@w:val = 'Literal']">
|
||||
<xsl:text>`</xsl:text>
|
||||
<xsl:value-of select="w:t" />
|
||||
<xsl:text>`</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="w:r">
|
||||
<xsl:value-of select="w:t" />
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="w:p">
|
||||
<xsl:value-of select="w:pPr/w:pStyle/@w:val" />
|
||||
Unmatched: <xsl:value-of select="w:pPr/w:pStyle/@w:val" />
|
||||
<xsl:text>
|
||||
</xsl:text>
|
||||
|
||||
|
||||
</xsl:template>
|
||||
</xsl:stylesheet>
|
||||
|
||||
Reference in New Issue
Block a user