Click here to Skip to main content
15,892,674 members
Articles / Web Development / HTML

Generating Word Reports / Documents

Rate me:
Please Sign up or sign in to vote.
4.94/5 (122 votes)
4 Oct 2009CPOL22 min read 708.4K   8K   544  
Generate Word documents by appling XSLT on XML data.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:ns1="http://schemas.microsoft.com/GeneratingWordDocuments/WordGeneratedInvoice.xsd">
  <xsl:output method="xml" encoding="UTF-8" standalone="yes" />
  <xsl:template match="/">
    <xsl:processing-instruction name="mso-application">
      <xsl:text>progid="Word.Document"</xsl:text>
    </xsl:processing-instruction>
    <w:wordDocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:ns1="http://schemas.microsoft.com/GeneratingWordDocuments/WordGeneratedInvoice.xsd" w:macrosPresent="no" w:embeddedObjPresent="no" w:ocxPresent="no" xml:space="preserve">
      <o:DocumentProperties>
        <o:Title>Word Generated Invoice</o:Title>
        <o:Author>xxx</o:Author>
        <o:LastAuthor>xxx</o:LastAuthor>
        <o:Revision>2</o:Revision>
        <o:TotalTime>13</o:TotalTime>
        <o:Created>2007-08-15T18:43:00Z</o:Created>
        <o:LastSaved>2007-08-15T18:43:00Z</o:LastSaved>
        <o:Pages>1</o:Pages>
        <o:Words>41</o:Words>
        <o:Characters>238</o:Characters>
        <o:Company>TOSHIBA</o:Company>
        <o:Lines>1</o:Lines>
        <o:Paragraphs>1</o:Paragraphs>
        <o:CharactersWithSpaces>278</o:CharactersWithSpaces>
        <o:Version>11.6568</o:Version>
      </o:DocumentProperties>
      <w:fonts>
        <w:defaultFonts w:ascii="Times New Roman" w:fareast="Times New Roman" w:h-ansi="Times New Roman" w:cs="Times New Roman" />
      </w:fonts>
      <w:lists>
        <w:listDef w:listDefId="0">
          <w:lsid w:val="FFFFFF7C" />
          <w:plt w:val="SingleLevel" />
          <w:tmpl w:val="D6C04602" />
          <w:lvl w:ilvl="0">
            <w:start w:val="1" />
            <w:lvlText w:val="%1." />
            <w:lvlJc w:val="left" />
            <w:pPr>
              <w:tabs>
                <w:tab w:val="list" w:pos="1800" />
              </w:tabs>
              <w:ind w:left="1800" w:hanging="360" />
            </w:pPr>
          </w:lvl>
        </w:listDef>
        <w:listDef w:listDefId="1">
          <w:lsid w:val="FFFFFF7D" />
          <w:plt w:val="SingleLevel" />
          <w:tmpl w:val="A4828066" />
          <w:lvl w:ilvl="0">
            <w:start w:val="1" />
            <w:lvlText w:val="%1." />
            <w:lvlJc w:val="left" />
            <w:pPr>
              <w:tabs>
                <w:tab w:val="list" w:pos="1440" />
              </w:tabs>
              <w:ind w:left="1440" w:hanging="360" />
            </w:pPr>
          </w:lvl>
        </w:listDef>
        <w:listDef w:listDefId="2">
          <w:lsid w:val="FFFFFF7E" />
          <w:plt w:val="SingleLevel" />
          <w:tmpl w:val="865032E2" />
          <w:lvl w:ilvl="0">
            <w:start w:val="1" />
            <w:lvlText w:val="%1." />
            <w:lvlJc w:val="left" />
            <w:pPr>
              <w:tabs>
                <w:tab w:val="list" w:pos="1080" />
              </w:tabs>
              <w:ind w:left="1080" w:hanging="360" />
            </w:pPr>
          </w:lvl>
        </w:listDef>
        <w:listDef w:listDefId="3">
          <w:lsid w:val="FFFFFF7F" />
          <w:plt w:val="SingleLevel" />
          <w:tmpl w:val="7BE2ECA6" />
          <w:lvl w:ilvl="0">
            <w:start w:val="1" />
            <w:lvlText w:val="%1." />
            <w:lvlJc w:val="left" />
            <w:pPr>
              <w:tabs>
                <w:tab w:val="list" w:pos="720" />
              </w:tabs>
              <w:ind w:left="720" w:hanging="360" />
            </w:pPr>
          </w:lvl>
        </w:listDef>
        <w:listDef w:listDefId="4">
          <w:lsid w:val="FFFFFF80" />
          <w:plt w:val="SingleLevel" />
          <w:tmpl w:val="9B62A6F8" />
          <w:lvl w:ilvl="0">
            <w:start w:val="1" />
            <w:nfc w:val="23" />
            <w:lvlText w:val="" />
            <w:lvlJc w:val="left" />
            <w:pPr>
              <w:tabs>
                <w:tab w:val="list" w:pos="1800" />
              </w:tabs>
              <w:ind w:left="1800" w:hanging="360" />
            </w:pPr>
            <w:rPr>
              <w:rFonts w:ascii="Symbol" w:h-ansi="Symbol" w:hint="default" />
            </w:rPr>
          </w:lvl>
        </w:listDef>
        <w:listDef w:listDefId="5">
          <w:lsid w:val="FFFFFF81" />
          <w:plt w:val="SingleLevel" />
          <w:tmpl w:val="691E1548" />
          <w:lvl w:ilvl="0">
            <w:start w:val="1" />
            <w:nfc w:val="23" />
            <w:lvlText w:val="" />
            <w:lvlJc w:val="left" />
            <w:pPr>
              <w:tabs>
                <w:tab w:val="list" w:pos="1440" />
              </w:tabs>
              <w:ind w:left="1440" w:hanging="360" />
            </w:pPr>
            <w:rPr>
              <w:rFonts w:ascii="Symbol" w:h-ansi="Symbol" w:hint="default" />
            </w:rPr>
          </w:lvl>
        </w:listDef>
        <w:listDef w:listDefId="6">
          <w:lsid w:val="FFFFFF82" />
          <w:plt w:val="SingleLevel" />
          <w:tmpl w:val="F3081A34" />
          <w:lvl w:ilvl="0">
            <w:start w:val="1" />
            <w:nfc w:val="23" />
            <w:lvlText w:val="" />
            <w:lvlJc w:val="left" />
            <w:pPr>
              <w:tabs>
                <w:tab w:val="list" w:pos="1080" />
              </w:tabs>
              <w:ind w:left="1080" w:hanging="360" />
            </w:pPr>
            <w:rPr>
              <w:rFonts w:ascii="Symbol" w:h-ansi="Symbol" w:hint="default" />
            </w:rPr>
          </w:lvl>
        </w:listDef>
        <w:listDef w:listDefId="7">
          <w:lsid w:val="FFFFFF83" />
          <w:plt w:val="SingleLevel" />
          <w:tmpl w:val="077C664C" />
          <w:lvl w:ilvl="0">
            <w:start w:val="1" />
            <w:nfc w:val="23" />
            <w:lvlText w:val="" />
            <w:lvlJc w:val="left" />
            <w:pPr>
              <w:tabs>
                <w:tab w:val="list" w:pos="720" />
              </w:tabs>
              <w:ind w:left="720" w:hanging="360" />
            </w:pPr>
            <w:rPr>
              <w:rFonts w:ascii="Symbol" w:h-ansi="Symbol" w:hint="default" />
            </w:rPr>
          </w:lvl>
        </w:listDef>
        <w:listDef w:listDefId="8">
          <w:lsid w:val="FFFFFF88" />
          <w:plt w:val="SingleLevel" />
          <w:tmpl w:val="95405364" />
          <w:lvl w:ilvl="0">
            <w:start w:val="1" />
            <w:lvlText w:val="%1." />
            <w:lvlJc w:val="left" />
            <w:pPr>
              <w:tabs>
                <w:tab w:val="list" w:pos="360" />
              </w:tabs>
              <w:ind w:left="360" w:hanging="360" />
            </w:pPr>
          </w:lvl>
        </w:listDef>
        <w:listDef w:listDefId="9">
          <w:lsid w:val="FFFFFF89" />
          <w:plt w:val="SingleLevel" />
          <w:tmpl w:val="AC9EDD36" />
          <w:lvl w:ilvl="0">
            <w:start w:val="1" />
            <w:nfc w:val="23" />
            <w:lvlText w:val="" />
            <w:lvlJc w:val="left" />
            <w:pPr>
              <w:tabs>
                <w:tab w:val="list" w:pos="360" />
              </w:tabs>
              <w:ind w:left="360" w:hanging="360" />
            </w:pPr>
            <w:rPr>
              <w:rFonts w:ascii="Symbol" w:h-ansi="Symbol" w:hint="default" />
            </w:rPr>
          </w:lvl>
        </w:listDef>
        <w:list w:ilfo="1">
          <w:ilst w:val="9" />
        </w:list>
        <w:list w:ilfo="2">
          <w:ilst w:val="7" />
        </w:list>
        <w:list w:ilfo="3">
          <w:ilst w:val="6" />
        </w:list>
        <w:list w:ilfo="4">
          <w:ilst w:val="5" />
        </w:list>
        <w:list w:ilfo="5">
          <w:ilst w:val="4" />
        </w:list>
        <w:list w:ilfo="6">
          <w:ilst w:val="8" />
        </w:list>
        <w:list w:ilfo="7">
          <w:ilst w:val="3" />
        </w:list>
        <w:list w:ilfo="8">
          <w:ilst w:val="2" />
        </w:list>
        <w:list w:ilfo="9">
          <w:ilst w:val="1" />
        </w:list>
        <w:list w:ilfo="10">
          <w:ilst w:val="0" />
        </w:list>
      </w:lists>
      <w:styles>
        <w:versionOfBuiltInStylenames w:val="4" />
        <w:latentStyles w:defLockedState="off" w:latentStyleCount="156" />
        <w:style w:type="paragraph" w:default="on" w:styleId="Normal">
          <w:name w:val="Normal" />
          <w:rsid w:val="006E03AC" />
          <w:rPr>
            <wx:font wx:val="Times New Roman" />
            <w:sz w:val="24" />
            <w:sz-cs w:val="24" />
            <w:lang w:val="EN-US" w:fareast="EN-US" w:bidi="AR-SA" />
          </w:rPr>
        </w:style>
        <w:style w:type="paragraph" w:styleId="Heading1">
          <w:name w:val="heading 1" />
          <wx:uiName wx:val="Heading 1" />
          <w:basedOn w:val="Normal" />
          <w:next w:val="Normal" />
          <w:rsid w:val="00DC1EE3" />
          <w:pPr>
            <w:pStyle w:val="Heading1" />
            <w:keepNext />
            <w:spacing w:before="240" w:after="60" />
            <w:outlineLvl w:val="0" />
          </w:pPr>
          <w:rPr>
            <w:rFonts w:ascii="Arial" w:h-ansi="Arial" w:cs="Arial" />
            <wx:font wx:val="Arial" />
            <w:b />
            <w:b-cs />
            <w:kern w:val="32" />
            <w:sz w:val="32" />
            <w:sz-cs w:val="32" />
          </w:rPr>
        </w:style>
        <w:style w:type="character" w:default="on" w:styleId="DefaultParagraphFont">
          <w:name w:val="Default Paragraph Font" />
          <w:semiHidden />
        </w:style>
        <w:style w:type="table" w:default="on" w:styleId="TableNormal">
          <w:name w:val="Normal Table" />
          <wx:uiName wx:val="Table Normal" />
          <w:semiHidden />
          <w:rPr>
            <wx:font wx:val="Times New Roman" />
          </w:rPr>
          <w:tblPr>
            <w:tblInd w:w="0" w:type="dxa" />
            <w:tblCellMar>
              <w:top w:w="0" w:type="dxa" />
              <w:left w:w="108" w:type="dxa" />
              <w:bottom w:w="0" w:type="dxa" />
              <w:right w:w="108" w:type="dxa" />
            </w:tblCellMar>
          </w:tblPr>
        </w:style>
        <w:style w:type="list" w:default="on" w:styleId="NoList">
          <w:name w:val="No List" />
          <w:semiHidden />
        </w:style>
        <w:style w:type="table" w:styleId="TableGrid">
          <w:name w:val="Table Grid" />
          <w:basedOn w:val="TableNormal" />
          <w:rsid w:val="00DC1EE3" />
          <w:rPr>
            <wx:font wx:val="Times New Roman" />
          </w:rPr>
          <w:tblPr>
            <w:tblInd w:w="0" w:type="dxa" />
            <w:tblBorders>
              <w:top w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto" />
              <w:left w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto" />
              <w:bottom w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto" />
              <w:right w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto" />
              <w:insideH w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto" />
              <w:insideV w:val="single" w:sz="4" wx:bdrwidth="10" w:space="0" w:color="auto" />
            </w:tblBorders>
            <w:tblCellMar>
              <w:top w:w="0" w:type="dxa" />
              <w:left w:w="108" w:type="dxa" />
              <w:bottom w:w="0" w:type="dxa" />
              <w:right w:w="108" w:type="dxa" />
            </w:tblCellMar>
          </w:tblPr>
        </w:style>
      </w:styles>
      <w:docPr>
        <w:view w:val="print" />
        <w:zoom w:percent="85" />
        <w:doNotEmbedSystemFonts />
        <w:proofState w:spelling="clean" w:grammar="clean" />
        <w:attachedTemplate w:val="" />
        <w:defaultTabStop w:val="720" />
        <w:punctuationKerning />
        <w:characterSpacingControl w:val="DontCompress" />
        <w:optimizeForBrowser />
        <w:validateAgainstSchema />
        <w:saveInvalidXML />
        <w:ignoreMixedContent />
        <w:alwaysShowPlaceholderText w:val="off" />
        <w:compat>
          <w:breakWrappedTables />
          <w:snapToGridInCell />
          <w:wrapTextWithPunct />
          <w:useAsianBreakRules />
          <w:dontGrowAutofit />
        </w:compat>
        <w:showXMLTags w:val="off" />
      </w:docPr>
      <w:body>
        <wx:sect>
          <xsl:apply-templates select="ns1:Invoice" />
          <w:sectPr>
            <w:pgSz w:w="12240" w:h="15840" />
            <w:pgMar w:top="1440" w:right="1800" w:bottom="1440" w:left="1800" w:header="720" w:footer="720" w:gutter="0" />
            <w:cols w:space="720" />
            <w:docGrid w:line-pitch="360" />
          </w:sectPr>
        </wx:sect>
      </w:body>
      <o:CustomDocumentProperties>
        <o:processingInstructions dt:dt="string"> <xsl:for-each select="processing-instruction()"><xsl:text>&lt;?</xsl:text><xsl:value-of select="name()" /><xsl:text> </xsl:text><xsl:value-of select="." /><xsl:text>?&gt;</xsl:text></xsl:for-each></o:processingInstructions>
      </o:CustomDocumentProperties>
    </w:wordDocument>
  </xsl:template>
  <xsl:template match="/ns1:Invoice">
    <ns1:Invoice>
      <xsl:for-each select="@ns1:*|@*[namespace-uri()='']">
        <xsl:attribute name="{name()}" namespace="{namespace-uri()}">
          <xsl:value-of select="." />
        </xsl:attribute>
      </xsl:for-each>
      <w:p>
        <w:pPr>
          <w:pStyle w:val="Heading1" />
        </w:pPr>
        <w:r> <w:t><xsl:text>Word Generated Invoice</xsl:text></w:t></w:r>
      </w:p>
      <w:p />
      <w:p>
        <w:r> <w:t><xsl:text>Buyer:</xsl:text></w:t></w:r>
        <w:r>
          <w:tab wx:wTab="75" wx:tlc="none" wx:cTlc="0" />
        </w:r>
        <w:r>
          <w:tab wx:wTab="720" wx:tlc="none" wx:cTlc="11" />
        </w:r>
        <xsl:apply-templates select="ns1:Buyer[1]" />
      </w:p>
      <w:p>
        <w:r> <w:t><xsl:text>Date:</xsl:text></w:t></w:r>
        <w:r>
          <w:tab wx:wTab="195" wx:tlc="none" wx:cTlc="2" />
        </w:r>
        <w:r>
          <w:tab wx:wTab="720" wx:tlc="none" wx:cTlc="11" />
        </w:r>
        <xsl:apply-templates select="ns1:InvoiceDate" />
      </w:p>
      <w:p />
      <w:p>
        <w:r> <w:t><xsl:text>Items:</xsl:text></w:t></w:r>
      </w:p>
      <w:tbl>
        <w:tblPr>
          <w:tblStyle w:val="TableGrid" />
          <w:tblW w:w="5000" w:type="pct" />
          <w:tblLook w:val="01E0" />
        </w:tblPr>
        <w:tblGrid>
          <w:gridCol w:w="5602" />
          <w:gridCol w:w="5602" />
        </w:tblGrid>
        <w:tr>
          <w:tc>
            <w:tcPr>
              <w:tcW w:w="4428" w:type="dxa" />
              <w:shd w:val="clear" w:color="auto" w:fill="E6E6E6" />
            </w:tcPr>
            <w:p>
              <w:pPr>
                <w:rPr>
                  <w:b />
                </w:rPr>
              </w:pPr>
              <w:r>
                <w:rPr>
                  <w:b />
                </w:rPr> <w:t><xsl:text>Name</xsl:text></w:t></w:r>
            </w:p>
          </w:tc>
          <w:tc>
            <w:tcPr>
              <w:tcW w:w="4428" w:type="dxa" />
              <w:shd w:val="clear" w:color="auto" w:fill="E6E6E6" />
            </w:tcPr>
            <w:p>
              <w:pPr>
                <w:rPr>
                  <w:b />
                </w:rPr>
              </w:pPr>
              <w:r>
                <w:rPr>
                  <w:b />
                </w:rPr> <w:t><xsl:text>Price</xsl:text></w:t></w:r>
            </w:p>
          </w:tc>
        </w:tr>
        <xsl:apply-templates select="ns1:InvoiceItems" />
      </w:tbl>
      <w:p />
      <w:p>
        <w:r> <w:t><xsl:text>Total:</xsl:text></w:t></w:r>
        <w:r>
          <w:tab wx:wTab="165" wx:tlc="none" wx:cTlc="2" />
        </w:r>
        <w:r>
          <w:tab wx:wTab="720" wx:tlc="none" wx:cTlc="11" />
        </w:r>
        <xsl:apply-templates select="ns1:Total" />
      </w:p>
      <w:p />
      <w:p />
      <w:p>
        <w:r> <w:t><xsl:text>Signatures:</xsl:text></w:t></w:r>
      </w:p>
      <w:tbl>
        <w:tblPr>
          <w:tblStyle w:val="TableGrid" />
          <w:tblW w:w="0" w:type="auto" />
          <w:tblBorders>
            <w:top w:val="none" w:sz="0" wx:bdrwidth="0" w:space="0" w:color="auto" />
            <w:left w:val="none" w:sz="0" wx:bdrwidth="0" w:space="0" w:color="auto" />
            <w:bottom w:val="none" w:sz="0" wx:bdrwidth="0" w:space="0" w:color="auto" />
            <w:right w:val="none" w:sz="0" wx:bdrwidth="0" w:space="0" w:color="auto" />
            <w:insideH w:val="none" w:sz="0" wx:bdrwidth="0" w:space="0" w:color="auto" />
            <w:insideV w:val="none" w:sz="0" wx:bdrwidth="0" w:space="0" w:color="auto" />
          </w:tblBorders>
          <w:tblLook w:val="01E0" />
        </w:tblPr>
        <w:tblGrid>
          <w:gridCol w:w="4428" />
          <w:gridCol w:w="4428" />
        </w:tblGrid>
        <w:tr>
          <w:tc>
            <w:tcPr>
              <w:tcW w:w="4428" w:type="dxa" />
            </w:tcPr>
            <w:p />
            <w:p>
              <w:r> <w:t><xsl:text>____________________________</xsl:text></w:t></w:r>
            </w:p>
            <w:p>
<w:r> <w:t><xsl:text>(Buyer: </xsl:text></w:t></w:r>
<xsl:apply-templates select="ns1:Buyer" />
<w:r> <w:t><xsl:text>)</xsl:text></w:t></w:r>
            </w:p>
          </w:tc>
          <w:tc>
            <w:tcPr>
              <w:tcW w:w="4428" w:type="dxa" />
            </w:tcPr>
            <w:p>
              <w:pPr>
                <w:jc w:val="right" />
              </w:pPr>
            </w:p>
            <w:p>
              <w:pPr>
                <w:jc w:val="right" />
              </w:pPr>
              <w:r> <w:t><xsl:text>____________________________</xsl:text></w:t></w:r>
            </w:p>
            <w:p>
              <w:pPr>
                <w:jc w:val="right" />
              </w:pPr>
              <w:r> <w:t><xsl:text>(Sales Agent: </xsl:text></w:t></w:r>
              <xsl:apply-templates select="ns1:SalesAgent" />
              <w:r> <w:t><xsl:text>)</xsl:text></w:t></w:r>
            </w:p>
          </w:tc>
        </w:tr>
      </w:tbl>
      <w:p />
      <w:p />
      <w:p />
    </ns1:Invoice>
  </xsl:template>
  <xsl:template match="/ns1:Invoice/ns1:InvoiceItems">
    <ns1:InvoiceItems>
      <xsl:for-each select="@ns1:*|@*[namespace-uri()='']">
        <xsl:attribute name="{name()}" namespace="{namespace-uri()}">
          <xsl:value-of select="." />
        </xsl:attribute>
      </xsl:for-each>
      <w:tr>
        <xsl:apply-templates select="ns1:Name|ns1:Price" />
      </w:tr>
    </ns1:InvoiceItems>
  </xsl:template>
  <xsl:template match="/ns1:Invoice/ns1:InvoiceItems/ns1:Price">
    <w:tc>
      <w:tcPr>
        <w:tcW w:w="4428" w:type="dxa" />
      </w:tcPr>
      <ns1:Price>
        <xsl:for-each select="@ns1:*|@*[namespace-uri()='']">
          <xsl:attribute name="{name()}" namespace="{namespace-uri()}">
            <xsl:value-of select="." />
          </xsl:attribute>
        </xsl:for-each>
        <w:p>
          <w:r> <w:t><xsl:value-of select="." /></w:t></w:r>
        </w:p>
      </ns1:Price>
    </w:tc>
  </xsl:template>
  <xsl:template match="/ns1:Invoice/ns1:InvoiceItems/ns1:Name">
    <w:tc>
      <w:tcPr>
        <w:tcW w:w="4428" w:type="dxa" />
      </w:tcPr>
      <ns1:Name>
        <xsl:for-each select="@ns1:*|@*[namespace-uri()='']">
          <xsl:attribute name="{name()}" namespace="{namespace-uri()}">
            <xsl:value-of select="." />
          </xsl:attribute>
        </xsl:for-each>
        <w:p>
          <w:r>
            <w:rPr>
              <w:b />
              <w:b-cs />
              <w:i />
              <w:i-cs />
            </w:rPr> <w:t><xsl:value-of select="." /></w:t></w:r>
        </w:p>
      </ns1:Name>
    </w:tc>
  </xsl:template>
  <xsl:template match="/ns1:Invoice/ns1:InvoiceDate">
    <ns1:InvoiceDate>
      <xsl:for-each select="@ns1:*|@*[namespace-uri()='']">
        <xsl:attribute name="{name()}" namespace="{namespace-uri()}">
          <xsl:value-of select="." />
        </xsl:attribute>
      </xsl:for-each>
      <w:r> <w:t><xsl:value-of select="." /></w:t></w:r>
    </ns1:InvoiceDate>
  </xsl:template>
  <xsl:template match="/ns1:Invoice/ns1:SalesAgent">
    <ns1:SalesAgent>
      <xsl:for-each select="@ns1:*|@*[namespace-uri()='']">
        <xsl:attribute name="{name()}" namespace="{namespace-uri()}">
          <xsl:value-of select="." />
        </xsl:attribute>
      </xsl:for-each>
      <w:r> <w:t><xsl:value-of select="." /></w:t></w:r>
    </ns1:SalesAgent>
  </xsl:template>
  <xsl:template match="/ns1:Invoice/ns1:Total">
    <ns1:Total>
      <xsl:for-each select="@ns1:*|@*[namespace-uri()='']">
        <xsl:attribute name="{name()}" namespace="{namespace-uri()}">
          <xsl:value-of select="." />
        </xsl:attribute>
      </xsl:for-each>
      <w:r> <w:t><xsl:value-of select="." /></w:t></w:r>
    </ns1:Total>
  </xsl:template>
  <xsl:template match="/ns1:Invoice/ns1:Buyer">
    <ns1:Buyer>
      <xsl:for-each select="@ns1:*|@*[namespace-uri()='']">
        <xsl:attribute name="{name()}" namespace="{namespace-uri()}">
          <xsl:value-of select="." />
        </xsl:attribute>
      </xsl:for-each>
      <w:r> <w:t><xsl:value-of select="." /></w:t></w:r>
    </ns1:Buyer>
  </xsl:template>
</xsl:stylesheet>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer
United States United States
If you liked this article, consider reading other articles by me. For republishing article on other websites, please contact me by leaving a comment.

Comments and Discussions