Commit 03ba7522 authored by O'Reilly Media, Inc.'s avatar O'Reilly Media, Inc.
Browse files

Initial commit

parents
Loading
Loading
Loading
Loading

9780596004934

0 → 120000
+1 −0
Changes for 9780596004934: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
9780596004934
 No newline at end of file

README.md

0 → 100644
+15 −0
Changes for README.md: 15 added lines, 0 removed lines.
Original line number Diff line number Diff line
## Example files for the title:  
  
# Word Hacks, by Andrew Savikas
  
[![Word Hacks, by Andrew Savikas](http://akamaicovers.oreilly.com/images/9780596004934/cat.gif)](https://www.safaribooksonline.com/library/view/title/0596004931//)
  
The following applies to example files from material published by O’Reilly Media, Inc. Content from other publishers may include different rules of usage. Please refer to any additional usage rights explained in the actual example files or refer to the publisher’s website.
  
O'Reilly books are here to help you get your job done. In general, you may use the code in O'Reilly books in your programs and documentation. You do not need to contact us for permission unless you're reproducing a significant portion of the code. For example, writing a program that uses several chunks of code from our books does not require permission. Answering a question by citing our books and quoting example code does not require permission. On the other hand, selling or distributing a CD-ROM of examples from O'Reilly books does require permission. Incorporating a significant amount of example code from our books into your product's documentation does require permission.
  
We appreciate, but do not require, attribution. An attribution usually includes the title, author, publisher, and ISBN.
  
If you think your use of code examples falls outside fair use or the permission given here, feel free to contact us at <permissions@oreilly.com>.
  
Please note that the examples are not production code and have not been carefully testing. They are provided "as-is" and come with no warranty of any kind.
+12 −0
Changes for WordHacks_CodeSamples/Chapter10/Hack91_Hello.xml: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?xml version="1.0"?>
<?mso-application progid="Word.Document"?>
<w:wordDocument
  xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml">
  <w:body>
    <w:p>
      <w:r>
        <w:t>Hello, World!</w:t>
      </w:r>
    </w:p>
  </w:body>
</w:wordDocument>
+121 −0
Changes for WordHacks_CodeSamples/Chapter10/Hack94_CreateStyledWordDoc.xml: 121 added lines, 0 removed lines.
Original line number Diff line number Diff line
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml">

  <xsl:output indent="yes"/>

  <xsl:template match="/">
    <xsl:processing-instruction name="mso-application">
      <xsl:text>progid="Word.Document"</xsl:text>
    </xsl:processing-instruction>
    <w:wordDocument>
      <xsl:attribute name="xml:space">preserve</xsl:attribute>
      <w:styles>
        <w:style w:styleId="h1" w:type="paragraph">
          <w:name w:val="Heading 1"/>
          <w:rPr>
            <w:sz w:val="32"/>
            <w:b/>
          </w:rPr>
        </w:style>
        <w:style w:styleId="h2" w:type="paragraph">
          <w:name w:val="Heading 2"/>
          <w:rPr>
            <w:sz w:val="28"/>
            <w:b/>
            <w:i/>
          </w:rPr>
        </w:style>
        <w:style w:styleId="emphasis" w:type="character">
          <w:name w:val="Italic"/>
          <w:rPr>
            <w:i/>
          </w:rPr>
        </w:style>
        <w:style w:styleId="strong" w:type="character">
          <w:name w:val="Bold"/>
          <w:rPr>
            <w:b/>
          </w:rPr>
        </w:style>
        <w:style w:styleId="emphasisAndStrong" w:type="character">
          <w:name w:val="Bold and Italic"/>
          <w:rPr>
            <w:b/>
            <w:i/>
          </w:rPr>
        </w:style>
      </w:styles>
      <w:body>
        <xsl:apply-templates select="/doc/*"/>
      </w:body>
    </w:wordDocument>
  </xsl:template>

  <xsl:template match="h1">
    <w:p>
      <w:pPr>
        <w:pStyle w:val="h1"/>
      </w:pPr>
      <xsl:apply-templates/>
    </w:p>
  </xsl:template>

  <xsl:template match="h2">
    <w:p>
      <w:pPr>
        <w:pStyle w:val="h2"/>
      </w:pPr>
      <xsl:apply-templates/>
    </w:p>
  </xsl:template>

  <xsl:template match="para">
    <w:p>
      <xsl:apply-templates/>
    </w:p>
  </xsl:template>

  <xsl:template match="h1/text() | h2/text() | para/text()">
    <w:r>
      <w:t>
        <xsl:copy/>
      </w:t>
    </w:r>
  </xsl:template>

  <xsl:template match="emphasis/text()">
    <w:r>
      <w:rPr>
        <w:rStyle w:val="emphasis"/>
      </w:rPr>
      <w:t>
        <xsl:copy/>
      </w:t>
    </w:r>
  </xsl:template>

  <xsl:template match="strong/text()">
    <w:r>
      <w:rPr>
        <w:rStyle w:val="strong"/>
      </w:rPr>
      <w:t>
        <xsl:copy/>
      </w:t>
    </w:r>
  </xsl:template>

  <xsl:template match="emphasis/strong/text() | strong/emphasis/text()"
                priority="1">
    <w:r>
      <w:rPr>
        <w:rStyle w:val="emphasisAndStrong"/>
      </w:rPr>
      <w:t>
        <xsl:copy/>
      </w:t>
    </w:r>
  </xsl:template>

</xsl:stylesheet>
+93 −0
Changes for WordHacks_CodeSamples/Chapter10/Hack94_CreateWordDocument.xsl: 93 added lines, 0 removed lines.
Original line number Diff line number Diff line
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml">

  <xsl:output indent="yes"/>

  <xsl:template match="/">
    <xsl:processing-instruction name="mso-application">
      <xsl:text>progid="Word.Document"</xsl:text>
    </xsl:processing-instruction>
    <w:wordDocument>
      <xsl:attribute name="xml:space">preserve</xsl:attribute>
      <w:body>
        <xsl:apply-templates select="/doc/*"/>
      </w:body>
    </w:wordDocument>
  </xsl:template>

  <xsl:template match="h1 | h2 | para">
    <w:p>
      <xsl:apply-templates/>
    </w:p>
  </xsl:template>

  <xsl:template match="h1/text()">
    <w:r>
      <w:rPr>
        <w:sz w:val="32"/>
        <w:b/>
      </w:rPr>
      <w:t>
        <xsl:copy/>
      </w:t>
    </w:r>
  </xsl:template>

  <xsl:template match="h2/text()">
    <w:r>
      <w:rPr>
        <w:sz w:val="28"/>
        <w:b/>
        <w:i/>
      </w:rPr>
      <w:t>
        <xsl:copy/>
      </w:t>
    </w:r>
  </xsl:template>

  <xsl:template match="para/text()">
    <w:r>
      <w:t>
        <xsl:copy/>
      </w:t>
    </w:r>
  </xsl:template>

  <xsl:template match="emphasis/text()">
    <w:r>
      <w:rPr>
        <w:i/>
      </w:rPr>
      <w:t>
        <xsl:copy/>
      </w:t>
    </w:r>
  </xsl:template>

  <xsl:template match="strong/text()">
    <w:r>
      <w:rPr>
        <w:b/>
      </w:rPr>
      <w:t>
        <xsl:copy/>
      </w:t>
    </w:r>
  </xsl:template>

  <xsl:template match="emphasis/strong/text() | strong/emphasis/text()"
                priority="1">
    <w:r>
      <w:rPr>
        <w:i/>
        <w:b/>
      </w:rPr>
      <w:t>
        <xsl:copy/>
      </w:t>
    </w:r>
  </xsl:template>

</xsl:stylesheet>
Loading