<xslt:stylesheet xmlns:xslt="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!-- © 2005 Stefan Mintert This is copyrighted material. Please read http://www.linkwerk.com/pub/xml/invitation/licence.txt The purpose of this XSLT style sheet is described online at http://www.linkwerk.com/pub/xml/invitation/. Legal notice: If you want to use my XSLT script, please read the Office 2003 XML Reference Schema Patent License at http://www.microsoft.com/mscorp/ip/format/xmlpatentlicense.asp While I don't call my piece of code a product I have to display the following note: "This product may incorporate intellectual property owned by Microsoft Corporation. The terms and conditions upon which Microsoft is licensing such intellectual property may be found at http://msdn.microsoft.com/library/en-us/odcXMLRef/html/odcXMLRefLegalNotice.asp" -->
<xslt:output method="xml" encoding="utf-8"></xslt:output>
<!-- ====================================================== -->
<!-- Template for root element 'invitation' -->
<xslt:template match="invitation">
<?mso-application progid="Word.Document"?>
<word:wordDocument xmlns:word="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:xml="http://www.w3.org/XML/1998/namespace" xml:space="preserve">
<o:DocumentProperties xmlns:o="urn:schemas-microsoft-com:office:office">
<o:Title>
Invitation to Birthday Party
</o:Title>
<o:Author>
invitation2wordml.xslt by Stefan Mintert, Linkwerk.com
</o:Author>
</o:DocumentProperties>
<word:docPr>
<word:view word:val="print"></word:view>
<word:zoom word:percent="80"></word:zoom>
</word:docPr>
<word:styles>
<!-- ========================================= -->
<!-- Paragraph Styles -->
<!-- ========================================= -->
<word:style word:type="paragraph" word:styleId="event" word:default="off">
<word:basedOn word:val="StandardPara"></word:basedOn>
<word:name word:val="Event"></word:name>
<word:pPr>
<word:jc word:val="center"></word:jc>
<word:shd word:val="clear" word:color="auto" word:fill="66BB66"></word:shd>
<word:spacing word:before="100" word:before-autospacing="off" word:after="300" word:after-autospacing="off"></word:spacing>
</word:pPr>
<word:rPr>
<word:b></word:b>
<word:shadow word:val="on"></word:shadow>
<word:sz word:val="72"></word:sz>
<word:color word:val="ffffff"></word:color>
</word:rPr>
</word:style>
<word:style word:type="paragraph" word:styleId="meta" word:default="off">
<word:basedOn word:val="StandardPara"></word:basedOn>
<word:name word:val="Meta"></word:name>
<word:rPr>
</word:rPr>
</word:style>
<word:style word:type="paragraph" word:styleId="footer" word:default="off">
<word:basedOn word:val="StandardPara"></word:basedOn>
<word:name word:val="Footer"></word:name>
<word:pPr>
<word:spacing word:before="1000" word:before-autospacing="off" word:after="300" word:after-autospacing="off"></word:spacing>
</word:pPr>
<word:rPr>
<word:sz word:val="18"></word:sz>
</word:rPr>
</word:style>
<word:style word:type="paragraph" word:styleId="" word:default="off">
<word:basedOn word:val="StandardPara"></word:basedOn>
<word:name word:val=""></word:name>
<word:pPr>
</word:pPr>
<word:rPr>
</word:rPr>
</word:style>
<!-- Default Paragraph Style -->
<word:style word:type="paragraph" word:styleId="StandardPara" word:default="on">
<word:name word:val="StandardPara"></word:name>
<word:pPr>
</word:pPr>
<word:rPr>
<word:rFonts word:ascii="Comic Sans MS" word:h-ansi="Comic Sans MS" word:cs="Comic Sans MS"></word:rFonts>
<word:sz word:val="36"></word:sz>
</word:rPr>
</word:style>
<!-- ========================================= -->
<!-- Character Styles -->
<!-- ========================================= -->
<word:style word:type="character" word:default="off" word:styleId="location">
<word:name word:val="location"></word:name>
<word:rPr>
<word:b></word:b>
<word:color word:val="ff0000"></word:color>
</word:rPr>
</word:style>
<word:style word:type="character" word:default="off" word:styleId="date">
<word:name word:val="Date"></word:name>
<word:rPr>
<word:b></word:b>
<word:color word:val="ff0000"></word:color>
</word:rPr>
</word:style>
<word:style word:type="character" word:default="off" word:styleId="time">
<word:name word:val="Time"></word:name>
<word:rPr>
<word:b></word:b>
<word:color word:val="ff0000"></word:color>
</word:rPr>
</word:style>
<word:style word:type="character" word:styleId="Hyperlink">
<word:name word:val="Hyperlink"></word:name>
<word:basedOn word:val="DefaultParagraphFont"></word:basedOn>
<!-- <word:rsid word:val="365462" /> -->
<word:rPr>
<word:color word:val="0000FF"></word:color>
<word:u word:val="single"></word:u>
</word:rPr>
</word:style>
</word:styles>
<word:body>
<xslt:apply-templates select="event"></xslt:apply-templates>
<word:p>
<word:pPr>
<word:pStyle word:val="meta"></word:pStyle>
</word:pPr>
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:t>
I'd like to invite you to come to
</word:t>
</word:r>
<xslt:apply-templates select="location"></xslt:apply-templates>
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:t>
.
</word:t>
</word:r>
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:t>
The event takes place on
</word:t>
</word:r>
<xslt:apply-templates select="date"></xslt:apply-templates>
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:t>
at
</word:t>
</word:r>
<xslt:apply-templates select="time"></xslt:apply-templates>
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:t>
.
</word:t>
</word:r>
</word:p>
<xslt:apply-templates select="description"></xslt:apply-templates>
<xslt:apply-templates select="dresscode"></xslt:apply-templates>
<word:p>
<word:pPr>
<word:pStyle word:val="footer"></word:pStyle>
</word:pPr>
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:t>
Generated from XML with invitation2html.xslt. Copyright ©
</word:t>
</word:r>
<word:hlink word:dest="http://www.mintert.com/">
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:rPr>
<word:rStyle word:val="Hyperlink"></word:rStyle>
</word:rPr>
<word:t>
Stefan Mintert
</word:t>
</word:r>
</word:hlink>
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:t>
, available at
</word:t>
</word:r>
<word:hlink word:dest="http://www.linkwerk.com/">
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:rPr>
<word:rStyle word:val="Hyperlink"></word:rStyle>
</word:rPr>
<word:t>
Linkwerk.com
</word:t>
</word:r>
</word:hlink>
</word:p>
</word:body>
</word:wordDocument>
</xslt:template>
<!-- ====================================================== -->
<!-- ====================================================== -->
<!-- Template for element type 'event' -->
<xslt:template match="event">
<word:p xmlns:word="http://schemas.microsoft.com/office/word/2003/wordml">
<word:pPr>
<word:pStyle word:val="event"></word:pStyle>
</word:pPr>
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:rPr>
<word:sz word:val="24"></word:sz>
</word:rPr>
<word:br></word:br>
</word:r>
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:t>
<xslt:apply-templates></xslt:apply-templates>
</word:t>
<word:br></word:br>
</word:r>
</word:p>
</xslt:template>
<!-- ====================================================== -->
<!-- ====================================================== -->
<!-- Template for some inline element types -->
<xslt:template match="location | date | time">
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:rPr xmlns:word="http://schemas.microsoft.com/office/word/2003/wordml">
<word:rStyle word:val="{local-name()}"></word:rStyle>
<word:t>
<xslt:apply-templates></xslt:apply-templates>
</word:t>
</word:rPr>
</word:r>
</xslt:template>
<!-- ====================================================== -->
<!-- ====================================================== -->
<!-- Template for element type 'description' -->
<xslt:template match="description">
<word:p xmlns:word="http://schemas.microsoft.com/office/word/2003/wordml">
<word:pPr>
<word:pStyle word:val="description"></word:pStyle>
</word:pPr>
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:rPr>
<word:b></word:b>
</word:rPr>
<word:t>
<word:br></word:br>
What's up?
</word:t>
</word:r>
</word:p>
<xslt:apply-templates></xslt:apply-templates>
</xslt:template>
<!-- ====================================================== -->
<!-- ====================================================== -->
<!-- Template for element type 'para' -->
<xslt:template match="para">
<word:p xmlns:word="http://schemas.microsoft.com/office/word/2003/wordml">
<word:pPr>
<word:pStyle word:val="description"></word:pStyle>
</word:pPr>
<xslt:apply-templates select="text()|*"></xslt:apply-templates>
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:t>
<word:br></word:br>
</word:t>
</word:r>
</word:p>
</xslt:template>
<!-- ====================================================== -->
<!-- ====================================================== -->
<!-- Template for text within 'para' -->
<xslt:template match="para/text()">
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:t xmlns:word="http://schemas.microsoft.com/office/word/2003/wordml">
<!-- <xslt:value-of select="normalize-space(.)"/> -->
<xslt:call-template name="lw:normalize-space"></xslt:call-template>
</word:t>
</word:r>
</xslt:template>
<!-- ====================================================== -->
<!-- ====================================================== -->
<!-- Template for element type 'emph' -->
<xslt:template match="text()">
<xslt:value-of select="normalize-space(.)"></xslt:value-of>
</xslt:template>
<!-- ====================================================== -->
<!-- ====================================================== -->
<!-- Template for element type 'emph' within 'para' -->
<xslt:template match="para/emph">
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:rPr xmlns:word="http://schemas.microsoft.com/office/word/2003/wordml">
<word:i></word:i>
</word:rPr>
<word:t xmlns:word="http://schemas.microsoft.com/office/word/2003/wordml">
<xslt:value-of select="."></xslt:value-of>
</word:t>
</word:r>
</xslt:template>
<!-- ====================================================== -->
<!-- ====================================================== -->
<!-- Template for element type 'dresscode' -->
<xslt:template match="dresscode">
<word:p xmlns:word="http://schemas.microsoft.com/office/word/2003/wordml">
<word:pPr>
<word:pStyle word:val="dresscode"></word:pStyle>
</word:pPr>
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:rPr>
<word:b></word:b>
</word:rPr>
<word:t>
What to wear?
<word:br></word:br>
</word:t>
</word:r>
<word:r xmlns="http://schemas.microsoft.com/office/word/2003/wordml">
<word:t>
<xslt:apply-templates></xslt:apply-templates>
</word:t>
</word:r>
</word:p>
</xslt:template>
<!-- ====================================================== -->
<xslt:template name="lw:normalize-space">
<xslt:param name="Node-Set" select="."></xslt:param>
<xslt:variable name="Result-Str">
<xslt:for-each select="$Node-Set">
<!-- add a delimiter at both sides of the string, then normalize -->
<xslt:variable name="Norm-Str" select="normalize-space(concat('!', ., '!'))"></xslt:variable>
<!-- remove the delimiter before returning the result -->
<xslt:value-of select="substring($Norm-Str, 2, string-length($Norm-Str)-2)"></xslt:value-of>
</xslt:for-each>
</xslt:variable>
<xslt:value-of select="$Result-Str"></xslt:value-of>
</xslt:template>
</xslt:stylesheet>