1<?xml version="1.0" encoding="UTF-8"?> 2 3 4 5<!-- 6 *********************************************************************** 7 * 8 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9 * 10 * Copyright 2000, 2010 Oracle and/or its affiliates. 11 * 12 * OpenOffice.org - a multi-platform office productivity suite 13 * 14 * This file is part of OpenOffice.org. 15 * 16 * OpenOffice.org is free software: you can redistribute it and/or modify 17 * it under the terms of the GNU Lesser General Public License version 3 18 * only, as published by the Free Software Foundation. 19 * 20 * OpenOffice.org is distributed in the hope that it will be useful, 21 * but WITHOUT ANY WARRANTY; without even the implied warranty of 22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 23 * GNU Lesser General Public License version 3 for more details 24 * (a copy is included in the LICENSE file that accompanied this code). 25 * 26 * You should have received a copy of the GNU Lesser General Public License 27 * version 3 along with OpenOffice.org. If not, see 28 * <http://www.openoffice.org/license.html> 29 * for a copy of the LGPLv3 License. 30 * 31 ************************************************************************ 32 --> 33 34 35 <helpdocument version="1.0"> 36<meta> 37<topic id="textsharedguidexsltfilter_createxhp" indexer="include" status="PUBLISH"> 38<title xml-lang="en-US" id="tit">Creating XML Filters </title> 39<filename>/text/shared/guide/xsltfilter_create.xhp</filename> 40</topic> 41</meta> 42<body> 43 44 45 46<bookmark xml-lang="en-US" branch="index" id="bm_id7007583"><bookmark_value>testing XML filters</bookmark_value> 47<bookmark_value>XML filters;creating/testing</bookmark_value> 48</bookmark> 49 <comment>mw moved 2 index entries from xsltfilter.xhp, then changed "XML filters;"</comment> 50 <paragraph xml-lang="en-US" id="hd_id1413922" role="heading" level="1" l10n="NEW"><variable id="xsltfilter"><link href="text/shared/guide/xsltfilter_create.xhp">Creating XML Filters</link> 51</variable></paragraph> 52 <paragraph xml-lang="en-US" id="par_idN1053D" role="heading" level="2" l10n="NEW">Creating an XML Filter for %PRODUCTNAME</paragraph> 53 <paragraph xml-lang="en-US" id="par_idN109A9" role="paragraph" l10n="NEW">When you create an XML filter for %PRODUCTNAME, you need to design an <emph>XSLT stylesheet</emph> that can convert to and from the OpenDocument XML file format.</paragraph> 54 <paragraph xml-lang="en-US" id="par_idN109B0" role="tip" l10n="NEW">For more information about the OpenDocument XML format, go to <link href="http://xml.openoffice.org/">http://xml.openoffice.org/</link>.</paragraph> 55 <paragraph xml-lang="en-US" id="par_idN109C5" role="paragraph" l10n="NEW">If you want, you can include a <emph>template</emph> with your filter to apply %PRODUCTNAME styles to an XML document that you import.</paragraph> 56 <paragraph xml-lang="en-US" id="par_idN109CC" role="paragraph" l10n="CHG">You can also include the <emph>Document Type Definition</emph> (DTD) for the external XML format so you can validate the XML format, for example, when you test the filter.</paragraph> 57 <paragraph xml-lang="en-US" id="par_idN10531" role="heading" level="2" l10n="NEW">To Create an XML Filter</paragraph> 58 <list type="ordered"> 59 <listitem> 60 <paragraph xml-lang="en-US" id="par_idN109E0" role="paragraph" l10n="NEW">Create an XSLT transformation <emph>stylesheet</emph> that maps the elements of the external XML format to the elements of the OpenDocument XML file format and back again.</paragraph> 61 </listitem> 62 <listitem> 63 <paragraph xml-lang="en-US" id="par_idN109E8" role="paragraph" l10n="NEW">Create a template that assigns %PRODUCTNAME styles to elements in the external XML format when you import a file in this format into %PRODUCTNAME.</paragraph> 64 </listitem> 65 <listitem> 66 <paragraph xml-lang="en-US" id="par_idN109EC" role="paragraph" l10n="NEW">In %PRODUCTNAME Writer, create a text document, and choose <item type="menuitem">Tools - XML Filter Settings</item>.</paragraph> 67 </listitem> 68 <listitem> 69 <paragraph xml-lang="en-US" id="par_idN109F4" role="paragraph" l10n="NEW">Click <emph>New</emph>.</paragraph> 70 </listitem> 71 <listitem> 72 <paragraph xml-lang="en-US" id="par_idN109FC" role="paragraph" l10n="NEW">In the <emph>XML Filter</emph> dialog, click the <emph>General</emph> tab, and define the properties of the filter.</paragraph> 73 </listitem> 74 </list> 75 <list type="unordered"> 76 <listitem> 77 <paragraph xml-lang="en-US" id="par_idN10A03" role="paragraph" l10n="NEW">In the <emph>Filter Name</emph> box, enter a name for the XML filter.</paragraph> 78 <paragraph xml-lang="en-US" id="par_idN10CA1" role="paragraph" l10n="NEW">This name is displayed in the <emph>XML Filter Settings</emph> dialog.</paragraph> 79 </listitem> 80 <listitem> 81 <paragraph xml-lang="en-US" id="par_idN10A09" role="paragraph" l10n="NEW">In the <emph>Application</emph> box, select the %PRODUCTNAME application that the filter is for.</paragraph> 82 </listitem> 83 <listitem> 84 <paragraph xml-lang="en-US" id="par_idN10A0F" role="paragraph" l10n="NEW">In the <emph>Name of File Type</emph> box, enter the file type that the filter is for.</paragraph> 85 <paragraph xml-lang="en-US" id="par_idN10CC6" role="paragraph" l10n="NEW">This name is displayed in the list of file types in the <emph>Open</emph>, <emph>Export</emph>, and <emph>Save As</emph> dialogs.</paragraph> 86 </listitem> 87 <listitem> 88 <paragraph xml-lang="en-US" id="par_idN10A15" role="paragraph" l10n="NEW">In the <emph>File extension</emph> box, enter the extension for the exported file.</paragraph> 89 <paragraph xml-lang="en-US" id="par_idN10A1B" role="note" l10n="NEW">To differentiate the file from other XML files, enter an extension other than *.xml.</paragraph> 90 </listitem> 91 </list> 92 <list type="ordered" startwith="6"> 93 <listitem> 94 <paragraph xml-lang="en-US" id="par_idN10A1F" role="paragraph" l10n="NEW">On the <emph>Transformation</emph> tab page, define the transformation properties for the filter.</paragraph> 95 </listitem> 96 </list> 97 <list type="unordered"> 98 <listitem> 99 <paragraph xml-lang="en-US" id="par_idN10A26" role="paragraph" l10n="NEW">(Optional) In the <emph>DocType</emph> box, enter the document type identifier for the external file format.</paragraph> 100 <paragraph xml-lang="en-US" id="par_idN10D0E" role="paragraph" l10n="NEW">This identifier is used to detect the file type on import.</paragraph> 101 </listitem> 102 <listitem> 103 <paragraph xml-lang="en-US" id="par_idN10A2C" role="paragraph" l10n="NEW">(Optional) In the <emph>DTD</emph> box, enter the path and file name of the DTD for the external file format.</paragraph> 104 <paragraph xml-lang="en-US" id="par_idN10D1F" role="paragraph" l10n="NEW">This DTD is used to validate the files on export.</paragraph> 105 </listitem> 106 <listitem> 107 <paragraph xml-lang="en-US" id="par_idN10A32" role="paragraph" l10n="NEW">In the <emph>XSLT for export</emph> box, enter the path and file name of the XSLT stylesheet that defines the transformation from OpenDocument format to the external format.</paragraph> 108 </listitem> 109 <listitem> 110 <paragraph xml-lang="en-US" id="par_idN10A38" role="paragraph" l10n="NEW">In the <emph>XSLT for import</emph> box, enter the path and file name to the XSLT stylesheet that defines the transformation from the external format to OpenDocument format.</paragraph> 111 </listitem> 112 <listitem> 113 <paragraph xml-lang="en-US" id="par_idN10A3E" role="paragraph" l10n="NEW">(Optional) In the <emph>Template for import</emph> box, enter the path and name of the template that defines the %PRODUCTNAME styles that are used in the imported file.</paragraph> 114 <paragraph xml-lang="en-US" id="par_idN10A44" role="note" l10n="NEW">The files that are specified on the <emph>Transformation</emph> tab page are copied to the local %PRODUCTNAME users directory.</paragraph> 115 </listitem> 116 </list> 117 <list type="ordered" startwith="7"> 118 <listitem> 119 <paragraph xml-lang="en-US" id="par_idN10A4C" role="paragraph" l10n="NEW">Click <emph>OK</emph>.</paragraph> 120 </listitem> 121 </list> 122 <paragraph xml-lang="en-US" id="par_idN10A56" role="heading" level="2" l10n="NEW">To Test an XML Filter</paragraph> 123 <paragraph xml-lang="en-US" id="par_idN10A5A" role="paragraph" l10n="NEW">You can perform basic tests on a custom XML filter in %PRODUCTNAME.</paragraph> 124 <paragraph xml-lang="en-US" id="par_idN10A91" role="note" l10n="NEW">The document is not altered by these tests. </paragraph> 125 <list type="ordered"> 126 <listitem> 127 <paragraph xml-lang="en-US" id="par_idN10A60" role="paragraph" l10n="NEW">Create or open a text document.</paragraph> 128 </listitem> 129 <listitem> 130 <paragraph xml-lang="en-US" id="par_idN10A67" role="paragraph" l10n="NEW">Choose <item type="menuitem">Tools - XML Filter Settings</item>.</paragraph> 131 </listitem> 132 <listitem> 133 <paragraph xml-lang="en-US" id="par_idN10A6F" role="paragraph" l10n="CHG">In the list of filters, select the filter that you want to test, and click <emph>Test XSLTs</emph>.</paragraph> 134 </listitem> 135 <listitem> 136 <paragraph xml-lang="en-US" id="par_idN10A82" role="paragraph" l10n="NEW">To test an <emph>Export</emph> Filter, do one of the following in the <emph>Export</emph> area of the dialog:</paragraph> 137 </listitem> 138 </list> 139 <list type="unordered"> 140 <listitem> 141 <paragraph xml-lang="en-US" id="par_idN10DEB" role="paragraph" l10n="NEW">Click <emph>Browse</emph>, select the %PRODUCTNAME document that you want to test, and click <emph>Open</emph>.</paragraph> 142 </listitem> 143 <listitem> 144 <paragraph xml-lang="en-US" id="par_idN10DF7" role="paragraph" l10n="NEW">To test the current document, click <emph>Current Document</emph>.</paragraph> 145 </listitem> 146 </list> 147 <list type="ordered" startwith="5"> 148 <listitem> 149 <paragraph xml-lang="en-US" id="par_idN10A99" role="paragraph" l10n="NEW">To test an <emph>Import</emph> Filter, click <emph>Browse</emph> in the <emph>Import</emph> area of the dialog, select a document, and click <emph>Open</emph>.</paragraph> 150 </listitem> 151 <listitem> 152 <paragraph xml-lang="en-US" id="par_idN10E32" role="paragraph" l10n="NEW">To validate the transformed file against the specified DTD, click <emph>Validate</emph>.</paragraph> 153 </listitem> 154 </list> 155 <section id="relatedtopics"> 156 157 <paragraph xml-lang="en-US" id="par_id8579668" role="paragraph" l10n="NEW"><link href="text/shared/guide/xsltfilter.xhp">About XML Filters</link></paragraph> 158 <paragraph xml-lang="en-US" id="par_id5569017" role="paragraph" l10n="NEW"><link href="text/shared/guide/xsltfilter_distribute.xhp">Distributing XML filters</link></paragraph> 159 160 </section> 161 </body> 162</helpdocument> 163