1<?xml version="1.0" encoding="UTF-8"?> 2 3 4 5<!--*********************************************************** 6 * 7 * Licensed to the Apache Software Foundation (ASF) under one 8 * or more contributor license agreements. See the NOTICE file 9 * distributed with this work for additional information 10 * regarding copyright ownership. The ASF licenses this file 11 * to you under the Apache License, Version 2.0 (the 12 * "License"); you may not use this file except in compliance 13 * with the License. You may obtain a copy of the License at 14 * 15 * http://www.apache.org/licenses/LICENSE-2.0 16 * 17 * Unless required by applicable law or agreed to in writing, 18 * software distributed under the License is distributed on an 19 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 20 * KIND, either express or implied. See the License for the 21 * specific language governing permissions and limitations 22 * under the License. 23 * 24 ***********************************************************--> 25 26 27 28 29 <helpdocument version="1.0"> 30<meta> 31<topic id="textsharedguidexsltfilter_createxhp" indexer="include" status="PUBLISH"> 32<title xml-lang="en-US" id="tit">Creating XML Filters </title> 33<filename>/text/shared/guide/xsltfilter_create.xhp</filename> 34</topic> 35</meta> 36<body> 37 38 39 40<bookmark xml-lang="en-US" branch="index" id="bm_id7007583"><bookmark_value>testing XML filters</bookmark_value> 41<bookmark_value>XML filters;creating/testing</bookmark_value> 42</bookmark> 43 <comment>mw moved 2 index entries from xsltfilter.xhp, then changed "XML filters;"</comment> 44 <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> 45</variable></paragraph> 46 <paragraph xml-lang="en-US" id="par_idN1053D" role="heading" level="2" l10n="NEW">Creating an XML Filter for %PRODUCTNAME</paragraph> 47 <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> 48 <paragraph xml-lang="en-US" id="par_idN109B0" role="tip" l10n="NEW">For more information about the OpenDocument XML format, go to <link href="https://xml.openoffice.org/">https://xml.openoffice.org/</link>.</paragraph> 49 <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> 50 <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> 51 <paragraph xml-lang="en-US" id="par_idN10531" role="heading" level="2" l10n="NEW">To Create an XML Filter</paragraph> 52 <list type="ordered"> 53 <listitem> 54 <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> 55 </listitem> 56 <listitem> 57 <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> 58 </listitem> 59 <listitem> 60 <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> 61 </listitem> 62 <listitem> 63 <paragraph xml-lang="en-US" id="par_idN109F4" role="paragraph" l10n="NEW">Click <emph>New</emph>.</paragraph> 64 </listitem> 65 <listitem> 66 <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> 67 </listitem> 68 </list> 69 <list type="unordered"> 70 <listitem> 71 <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> 72 <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> 73 </listitem> 74 <listitem> 75 <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> 76 </listitem> 77 <listitem> 78 <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> 79 <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> 80 </listitem> 81 <listitem> 82 <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> 83 <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> 84 </listitem> 85 </list> 86 <list type="ordered" startwith="6"> 87 <listitem> 88 <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> 89 </listitem> 90 </list> 91 <list type="unordered"> 92 <listitem> 93 <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> 94 <paragraph xml-lang="en-US" id="par_idN10D0E" role="paragraph" l10n="NEW">This identifier is used to detect the file type on import.</paragraph> 95 </listitem> 96 <listitem> 97 <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> 98 <paragraph xml-lang="en-US" id="par_idN10D1F" role="paragraph" l10n="NEW">This DTD is used to validate the files on export.</paragraph> 99 </listitem> 100 <listitem> 101 <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> 102 </listitem> 103 <listitem> 104 <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> 105 </listitem> 106 <listitem> 107 <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> 108 <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> 109 </listitem> 110 </list> 111 <list type="ordered" startwith="7"> 112 <listitem> 113 <paragraph xml-lang="en-US" id="par_idN10A4C" role="paragraph" l10n="NEW">Click <emph>OK</emph>.</paragraph> 114 </listitem> 115 </list> 116 <paragraph xml-lang="en-US" id="par_idN10A56" role="heading" level="2" l10n="NEW">To Test an XML Filter</paragraph> 117 <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> 118 <paragraph xml-lang="en-US" id="par_idN10A91" role="note" l10n="NEW">The document is not altered by these tests. </paragraph> 119 <list type="ordered"> 120 <listitem> 121 <paragraph xml-lang="en-US" id="par_idN10A60" role="paragraph" l10n="NEW">Create or open a text document.</paragraph> 122 </listitem> 123 <listitem> 124 <paragraph xml-lang="en-US" id="par_idN10A67" role="paragraph" l10n="NEW">Choose <item type="menuitem">Tools - XML Filter Settings</item>.</paragraph> 125 </listitem> 126 <listitem> 127 <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> 128 </listitem> 129 <listitem> 130 <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> 131 </listitem> 132 </list> 133 <list type="unordered"> 134 <listitem> 135 <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> 136 </listitem> 137 <listitem> 138 <paragraph xml-lang="en-US" id="par_idN10DF7" role="paragraph" l10n="NEW">To test the current document, click <emph>Current Document</emph>.</paragraph> 139 </listitem> 140 </list> 141 <list type="ordered" startwith="5"> 142 <listitem> 143 <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> 144 </listitem> 145 <listitem> 146 <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> 147 </listitem> 148 </list> 149 <section id="relatedtopics"> 150 151 <paragraph xml-lang="en-US" id="par_id8579668" role="paragraph" l10n="NEW"><link href="text/shared/guide/xsltfilter.xhp">About XML Filters</link></paragraph> 152 <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> 153 154 </section> 155 </body> 156</helpdocument> 157