XSLT 1.0
Processor: MSXML
I have the following XML file (fragment):
<?xml version="1.0" encoding="UTF-8"
standalone="yes"?>
<w:document
xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
xmlns:w10="urn:schemas-microsoft-com:office:word"
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml">
<w:body>
<w:p w:rsidR="007D3364" w:rsidRDefault="007D3364"
w:rsidP="007D3364">
<w:pPr>
<w:pStyle w:val="NormalWeb"/>
</w:pPr>
<w:r>
<w:t>sample</w:t>
</w:r>
<w:r w:rsidR="00200227">
<w:object w:dxaOrig="9689" w:dyaOrig="6866">
<v:shapetype id="_x0000_t75"
coordsize="21600,21600" o:spt="75"
o:preferrelative="t" path="m(_at_)4@5l(_at_)4@11(_at_)9@11(_at_)9@5xe"
filled="f" stroked="f">
<v:stroke joinstyle="miter"/>
<v:formulas>
<v:f eqn="if lineDrawn pixelLineWidth 0"/>
<v:f eqn="sum @0 1 0"/>
<v:f eqn="sum 0 0 @1"/>
<v:f eqn="prod @2 1 2"/>
<v:f eqn="prod @3 21600 pixelWidth"/>
<v:f eqn="prod @3 21600 pixelHeight"/>
<v:f eqn="sum @0 0 1"/>
<v:f eqn="prod @6 1 2"/>
<v:f eqn="prod @7 21600 pixelWidth"/>
<v:f eqn="sum @8 21600 0"/>
<v:f eqn="prod @7 21600 pixelHeight"/>
<v:f eqn="sum @10 21600 0"/>
</v:formulas>
<v:path o:extrusionok="f" gradientshapeok="t"
o:connecttype="rect"/>
<o:lock v:ext="edit" aspectratio="t"/>
</v:shapetype>
<v:shape id="_x0000_i1025" type="#_x0000_t75"
style="width:484.5pt;height:343.5pt" o:ole="">
<v:imagedata r:id="rId4" o:title=""/>
</v:shape>
<w:OLEObject Type="Embed"
ProgID="Word.Document.12" ShapeID="_x0000_i1025"
DrawAspect="Content" ObjectID="_1234025626"
r:id="rId5"/>
</w:object>
</w:r>
</w:p>
</w:body>
</w:document>
In my stylesheet I'm trying to replace <w:object>
element with <w:pict> element.
Also, I have to get rid off <w:OLEObject> element
and drop "o:ole" attribute from the <v:shape> element
Here is my stylesheet:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:o="urn:schemas-microsoft-
com:office:office"
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"
xmlns:v="urn:schemas-microsoft-com:vml"
xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"
xmlns:w10="urn:schemas-microsoft
-com:office:word"
xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml"
exclude-result-prefixes="ve o r m v wp w10 w wne">
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="w:object">
<w:pict>
<xsl:apply-templates/>
<xsl:apply-templates select="OLEObject"/>
<xsl:apply-templates select ="@o:ole"/>
</w:pict>
</xsl:template>
<xsl:template match="OLEObject"/>
<xsl:template match="@o:ole"/>
</xsl:stylesheet>
The output is all right except that the <v:shape>
element still has attribute "o:ole" present
Another thing is that I had to drop "w" prefix for the
OLEObject element to get the desired output.
Thanks,
Michael
____________________________________________________________________________________
Be a better Globetrotter. Get better travel answers from someone who knows.
Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545469
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--