- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <!-- *******************************************************
Real simple XSL Template to change the inline style that is formatting the placement of the the photo embeded in the XHTML content in a Business Wire NEWSML Document . This source code is provided free of charge and placed in the public domain. This program is meant to demonstrate one possible way to implement the conversion of Business Wire NewsML with XHTML content into an HTML document. It is not supported by Business Wire.
Use this software at your own risk.
$ RCSfile: ,v $
$ Last modified by Author: jaysonl $
$Date: $
$Revision: $
$copyright 2010(c) Business Wire $
$ author Jayson Lorenzen $
******************************************************************
-->
<xsl:output method="xml" encoding="UTF-8" omit-xml-declaration="no" media-type="xml" />
- <!--
************************* Variables ***************************************************
-->
<xsl:variable name="newline" select="' '" />
<xsl:variable name="xhtmlns" select="'http://www.w3.org/1999/xhtml'" />
- <!--
New Style to float the text to the left of the photo
-->
<xsl:variable name="newStyle" select="'width:300px; float: right; padding-left:20px; padding-right: 0px; padding-top: 0px; padding-bottom: 0px;'" />
- <!--
************************** / Variables **************************************************
-->
- <!--
MATCH AND COPY THE NEWSML DOCUMENT
-->
- <xsl:template match="NewsML">
<xsl:value-of select="$newline" />
- <xsl:element name="NewsML">
<xsl:apply-templates select="@*|node()" />
</xsl:element>
</xsl:template>
- <!--
CHANGE THE STYLE THE PHOTO
-->
- <xsl:template match="/NewsML/NewsItem/NewsComponent/NewsComponent/NewsComponent[Role/@FormalName='Body']/ContentItem[Format/@FormalName='XHTML']/DataContent/*[namespace-uri()='http://www.w3.org/1999/xhtml' and local-name()='html']/*[namespace-uri()='http://www.w3.org/1999/xhtml' and local-name()='body']/*[namespace-uri()='http://www.w3.org/1999/xhtml' and local-name()='div'][@id='bwbodyimg'] | /NewsML/NewsItem/NewsComponent/NewsComponent/NewsComponent[Role/@FormalName='Summary']/ContentItem[Format/@FormalName='XHTML']/DataContent/*[namespace-uri()='http://www.w3.org/1999/xhtml' and local-name()='html']/*[namespace-uri()='http://www.w3.org/1999/xhtml' and local-name()='body']/*[namespace-uri()='http://www.w3.org/1999/xhtml' and local-name()='div'][@id='bwbodyimg']">
- <div xmlns="http://www.w3.org/1999/xhtml">
<xsl:copy-of select="@id" />
- <xsl:attribute name="style">
<xsl:value-of select="$newStyle" />
</xsl:attribute>
- <xsl:for-each select="child::*">
<xsl:value-of select="$newline" />
- <xsl:element name="{local-name(.)}">
<xsl:apply-templates select="@*|node()" />
</xsl:element>
</xsl:for-each>
</div>
<xsl:value-of select="$newline" />
</xsl:template>
- <!--
DOES A RECURSIVE COPY
-->
- <xsl:template match="@*|node()">
- <xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>
</xsl:stylesheet>