[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [oiic-formation-discuss] Reason and example arguing for the use of an ODF (or XML) canonical form
This will identify any 'foreign' content in an odf document Usage as a comment. HTH <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dp="http://www.dpawson.co.uk/ns#" xmlns:xs ="http://www.w3.org/2001/XMLSchema" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style ="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text ="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table ="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw ="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo ="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink ="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta ="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg ="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart ="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d ="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math ="http://www.w3.org/1998/Math/MathML" xmlns:form ="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:pres="urn:oasis:names:tc:opendocument:xmlns:presentation:1.0" xmlns:anim ="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xmlns:smil ="urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0" xmlns:manifest="urn:oasis:names:tc:opendocument:xmlns:manifest:1.0" version="2.0"> <!-- Copyright 2008 Dave Pawson foreign.xsl is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. foreign.xsl is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with foreign.xsl. If not, see <http://www.gnu.org/licenses/>. --> <!-- Usage: Download http://prdownloads.sourceforge.net/saxon/saxonb9-1-0-1j.zip Unzip saxon9.jar from that. run with >java -jar saxon9.jar -o report.html {inputfile} foreign.xsl where inputfile is any ODF xml file Then see 'report.html' --> <d:doc xmlns:d="http://www.dpawson.co.uk/ns#"> <revhistory> <purpose><para>This stylesheet works with an ODF file to produce a report on foreign content</para></purpose> <revision> <revnumber>1.0</revnumber> <date> 2008</date> <authorinitials>DaveP</authorinitials> <revdescription> <para></para> </revdescription> <revremark></revremark> </revision> </revhistory> </d:doc> <xsl:output method="html" indent="yes" encoding="utf-8"/> <xsl:variable name="valid" as="xs:string*"> <xsl:sequence select="'urn:oasis:names:tc:opendocument:xmlns:office:1.0', 'urn:oasis:names:tc:opendocument:xmlns:style:1.0', 'urn:oasis:names:tc:opendocument:xmlns:text:1.0', 'urn:oasis:names:tc:opendocument:xmlns:table:1.0', 'urn:oasis:names:tc:opendocument:xmlns:drawing:1.0', 'urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0', 'http://www.w3.org/1999/xlink', 'http://purl.org/dc/elements/1.1/', 'urn:oasis:names:tc:opendocument:xmlns:meta:1.0', 'urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0', 'urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0', 'urn:oasis:names:tc:opendocument:xmlns:chart:1.0', 'urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0', 'http://www.w3.org/1998/Math/MathML', 'urn:oasis:names:tc:opendocument:xmlns:form:1.0', 'urn:oasis:names:tc:opendocument:xmlns:script:1.0', 'http://www.w3.org/2002/xforms', 'urn:oasis:names:tc:opendocument:xmlns:config:1.0', 'urn:oasis:names:tc:opendocument:xmlns:presentation:1.0', 'urn:oasis:names:tc:opendocument:xmlns:animation:1.0', 'urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0', 'urn:oasis:names:tc:opendocument:xmlns:manifest:1.0' "/> </xsl:variable> <xsl:template match="/"> <html> <head> <title> </title> <link rel="STYLESHEET" href="xxx.css" type="text/css"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body bgcolor="#FFFFFF"> <h2>Report on foreign content in file <xsl:value-of select="document-uri(/)"/></h2> <p><i>Copyright © Dave Pawson, 2008</i></p> <p>Version 1.0. 2008-07-07T09:30:51Z</p> <xsl:apply-templates/> </body> </html> </xsl:template> <xsl:template match="*"> <xsl:if test="not(namespace-uri(.) = $valid)"> <p> <xsl:text>Element </xsl:text><xsl:value-of select="name()"/><xsl:text> </xsl:text> <xsl:text>In namespace </xsl:text><xsl:value-of select="namespace-uri()"/> <xsl:if test="text()"> <br /> Content (<xsl:value-of select="."/>) </xsl:if> <xsl:if test="@*"> <xsl:for-each select="@*"> <br /> Attributes: <xsl:value-of select="name(.)"/>=<xsl:value-of select="."/> </xsl:for-each> </xsl:if> </p> </xsl:if> <xsl:apply-templates/> </xsl:template> <xsl:template match="text()"/> </xsl:stylesheet>
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]