XML to XSL Converter
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 4
- Joined: Mon Jul 02, 2012 8:18 pm
XML to XSL Converter
Post by Armin Egginger »
Hi all,
is it possible to convert a xml file to a xsl file with Oxygen?
I use Version 14.
like
<o:thisElement value="hidden" language="english">
Convert into
<xsl:element name="o:thisElement">
<xsl:attribute name="value">hidden</xsl:attribute>
<xsl:attribute name="language">english</xsl:attribute>
</xsl:element>
Some tipps?
best regards
armin
is it possible to convert a xml file to a xsl file with Oxygen?
I use Version 14.
like
<o:thisElement value="hidden" language="english">
Convert into
<xsl:element name="o:thisElement">
<xsl:attribute name="value">hidden</xsl:attribute>
<xsl:attribute name="language">english</xsl:attribute>
</xsl:element>
Some tipps?
best regards
armin
-
- Posts: 846
- Joined: Mon Dec 05, 2011 6:04 pm
Re: XML to XSL Converter
Hello,
Unfortunately, converting any XML file to an XSL one is not possible yet.
However, I've logged your specific issue as a feature request in our issue tracking system and it will be analyzed for a possible implementation in a future version of oXygen.
Regards,
Costin
Unfortunately, converting any XML file to an XSL one is not possible yet.
However, I've logged your specific issue as a feature request in our issue tracking system and it will be analyzed for a possible implementation in a future version of oXygen.
Regards,
Costin
Costin Sandoi
oXygen XML Editor and Author Support
oXygen XML Editor and Author Support
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Re: XML to XSL Converter
Well, actually you can do this with a very simple XSLT stylesheet, like the one below:
Then, if you apply this on
it will generate
And this stylesheet will generate back the initial XML
Hope that helps,
George
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="a"
exclude-result-prefixes="a" version="2.0">
<xsl:output indent="yes"/>
<xsl:namespace-alias stylesheet-prefix="a" result-prefix="xsl"/>
<xsl:template match="/">
<a:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<a:template match="/">
<xsl:apply-templates/>
</a:template>
</a:stylesheet>
</xsl:template>
<xsl:template match="*">
<a:element name="{name()}" namespace="{namespace-uri()}">
<xsl:apply-templates select="node()"/>
</a:element>
</xsl:template>
<xsl:template match="@*">
<a:attribute name="{name()}" namespace="{namespace-uri()}"/>
</xsl:template>
<xsl:template match="text()">
<a:text><xsl:value-of select="."/></a:text>
</xsl:template>
</xsl:stylesheet>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<o:test xmlns:o="http://o">
<o:thisElement value="hidden" language="english"/>
</o:test>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="/">
<xsl:element name="o:test" namespace="http://o">
<xsl:text>
</xsl:text>
<xsl:element name="o:thisElement" namespace="http://o"/>
<xsl:text>
</xsl:text>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?><o:test xmlns:o="http://o">
<o:thisElement/>
</o:test>
George
George Cristian Bina
-
- Posts: 4
- Joined: Mon Jul 02, 2012 8:18 pm
Re: XML to XSL Converter
Post by Armin Egginger »
Hi George,
thx for the idea with a XSLT - cool, because i have some 2000 lines xml to change in the future in xslt.
Your XSLT work for elements right now, but not for attributes.
Do you have an idea, why it doesn't transform the attributes?
best regards
armin
thx for the idea with a XSLT - cool, because i have some 2000 lines xml to change in the future in xslt.
Your XSLT work for elements right now, but not for attributes.
Do you have an idea, why it doesn't transform the attributes?
best regards
armin
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Re: XML to XSL Converter
Sorry, because node() does not select attribute nodes, you need to add @* in the apply-templates instruction, see the complete stylesheet below:
Regards,
George
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="a"
exclude-result-prefixes="a" version="2.0">
<xsl:output indent="yes"/>
<xsl:namespace-alias stylesheet-prefix="a" result-prefix="xsl"/>
<xsl:template match="/">
<a:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<a:template match="/">
<xsl:apply-templates/>
</a:template>
</a:stylesheet>
</xsl:template>
<xsl:template match="*">
<a:element name="{name()}" namespace="{namespace-uri()}">
<xsl:apply-templates select="@*|node()"/>
</a:element>
</xsl:template>
<xsl:template match="@*">
<a:attribute name="{name()}" namespace="{namespace-uri()}"/>
</xsl:template>
<xsl:template match="text()">
<a:text><xsl:value-of select="."/></a:text>
</xsl:template>
</xsl:stylesheet>
George
George Cristian Bina
-
- Posts: 4
- Joined: Mon Jul 02, 2012 8:18 pm
Re: XML to XSL Converter
Post by Armin Egginger »
Hi George,
i changed some lines, but now the "strip-space" doesn't work.
The XSL sends all whitespaces into the result.
Do you have an idea, why it doesn't work?
The result includes all whitespaces
Also another question:
Is it possible to change a <xsl:stylesheet> with this stylesheet? It must return all <xsl:elements + code> 1:1 to the new structure.
best regards
armin
i changed some lines, but now the "strip-space" doesn't work.
The XSL sends all whitespaces into the result.
Do you have an idea, why it doesn't work?
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:x="a"
exclude-result-prefixes="x" version="2.0">
<xsl:strip-space elements="*"/>
<xsl:output indent="yes"/>
<xsl:namespace-alias stylesheet-prefix="x" result-prefix="xsl"/>
<xsl:template match="/">
<x:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<x:template match="/">
<xsl:apply-templates/>
</x:template>
</x:stylesheet>
</xsl:template>
<xsl:template match="*">
<xsl:for-each select="node()">
<x:element name="{name()}" namespace="{namespace-uri()}">
<xsl:apply-templates select="@*|node()"/>
</x:element>
</xsl:for-each>
</xsl:template>
<xsl:template match="@*">
<xsl:variable name="xContent">
<xsl:value-of select="normalize-space(.)"/>
</xsl:variable>
<x:attribute name="{name()}" namespace="{namespace-uri()}">
<x:text>
<xsl:value-of select="$xContent"/>
</x:text>
</x:attribute>
</xsl:template>
<xsl:template match="text()">
<x:text>
<xsl:value-of select="."/>
</x:text>
</xsl:template>
</xsl:stylesheet>
Code: Select all
<xsl:element name="" namespace=""/>
<xsl:text>
</xsl:text>
Is it possible to change a <xsl:stylesheet> with this stylesheet? It must return all <xsl:elements + code> 1:1 to the new structure.
best regards
armin
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Re: XML to XSL Converter
Hi Armin,
I do not understand why you changed the template that matches elements to
If you wanted the root element not to appear in the output you can match on that and just apply templates further in its children without emitting an xsl:element for it:
Exactly the code in the above template (<xsl:for-each select="node()">) generates the invalid xsl:element instruction in the output, as node() can match not only elements but also text nodes, comments, etc. If you still want to keep your logic then the select should use * to match the children elements only.
If you do not want the xsl prefix in the generated output then the stylesheet should start with
Regards,
George
I do not understand why you changed the template that matches elements to
Code: Select all
<xsl:template match="*">
<xsl:for-each select="node()">
<x:element name="{name()}" namespace="{namespace-uri()}">
<xsl:apply-templates select="@*|node()"/>
</x:element>
</xsl:for-each>
</xsl:template>
Code: Select all
<xsl:template match="/*">
<xsl:apply-templates select="node()"/>
</xsl:template>
If you do not want the xsl prefix in the generated output then the stylesheet should start with
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="a"
exclude-result-prefixes="a"
xmlns="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:output indent="yes"/>
<xsl:namespace-alias stylesheet-prefix="a" result-prefix="#default"/>
...
George
George Cristian Bina
-
- Posts: 4
- Joined: Mon Jul 02, 2012 8:18 pm
Re: XML to XSL Converter
Post by Armin Egginger »
Dear George,
i read some information about the whitespace and checked all whitespace options,
but i can't get the result without the whitespaces.
I tried your origin xsl to be sure, that my coding isn't the problem.
The xsl preferences (-strip) in oxygen in the xslt-szenario is (all).
This is the XML of an Word Document (only a part).
If I use the xslt stylesheet from you
i get the result with many whitespaces inside
Why did i get it? What is the difference between your and my system?
Thanks for any help.
best regards
armin
i read some information about the whitespace and checked all whitespace options,
but i can't get the result without the whitespaces.
I tried your origin xsl to be sure, that my coding isn't the problem.
The xsl preferences (-strip) in oxygen in the xslt-szenario is (all).
This is the XML of an Word Document (only a part).
Code: Select all
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:wordDocument xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl"
xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:sl="http://schemas.microsoft.com/schemaLibrary/2003/core" xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" w:macrosPresent="no" w:embeddedObjPresent="no" w:ocxPresent="no" xml:space="preserve">
<o:DocumentProperties/>
<w:fonts>
<w:defaultFonts w:ascii="Arial" w:fareast="Arial" w:h-ansi="Arial" w:cs="Arial"/>
<w:font w:name="Tahoma">
<w:panose-1 w:val="020B0604030504040204"/>
<w:charset w:val="00"/>
<w:family w:val="Swiss"/>
<w:pitch w:val="variable"/>
<w:sig w:usb-0="61007A87" w:usb-1="80000000" w:usb-2="00000008" w:usb-3="00000000" w:csb-0="000101FF" w:csb-1="00000000"/>
</w:font>
<w:font w:name="Verdana">
<w:panose-1 w:val="020B0604030504040204"/>
<w:charset w:val="00"/>
<w:family w:val="Swiss"/>
<w:pitch w:val="variable"/>
<w:sig w:usb-0="20000287" w:usb-1="00000000" w:usb-2="00000000" w:usb-3="00000000" w:csb-0="0000019F" w:csb-1="00000000"/>
</w:font>
</w:fonts>
<w:lists>
<w:listDef w:listDefId="100">
<w:lsid w:val="44CD38B3"/>
<w:plt w:val="Multilevel"/>
<w:tmpl w:val="27264C1A"/>
<w:lvl w:ilvl="0">
<w:start w:val="1"/>
<w:lvlText w:val="%1."/>
<w:lvlJc w:val="left"/>
<w:pPr>
<w:ind w:left="340" w:hanging="340"/>
</w:pPr>
<w:rPr>
<w:rFonts w:hint="default"/>
</w:rPr>
</w:lvl>
<w:lvl w:ilvl="1">
<w:start w:val="1"/>
<w:lvlText w:val="%1.%2"/>
<w:lvlJc w:val="left"/>
<w:pPr>
<w:ind w:left="576" w:hanging="9"/>
</w:pPr>
<w:rPr>
<w:rFonts w:hint="default"/>
</w:rPr>
</w:lvl>
<w:lvl w:ilvl="2">
<w:start w:val="1"/>
<w:lvlText w:val="%1.%2.%3"/>
<w:lvlJc w:val="left"/>
<w:pPr>
<w:tabs>
<w:tab w:val="list" w:pos="1021"/>
</w:tabs>
<w:ind w:left="720" w:first-line="131"/>
</w:pPr>
<w:rPr>
<w:rFonts w:hint="default"/>
</w:rPr>
</w:lvl>
</w:listDef>
<w:list w:ilfo="300">
<w:ilst w:val="100"/>
</w:list>
</w:lists>
</w:wordDocument>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:a="a"
exclude-result-prefixes="a" version="2.0">
<xsl:output indent="yes"/>
<xsl:namespace-alias stylesheet-prefix="a" result-prefix="xsl"/>
<xsl:template match="/">
<a:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<a:template match="/">
<xsl:apply-templates/>
</a:template>
</a:stylesheet>
</xsl:template>
<xsl:template match="*">
<a:element name="{name()}" namespace="{namespace-uri()}">
<xsl:apply-templates select="@*|node()"/>
</a:element>
</xsl:template>
<xsl:template match="@*">
<a:attribute name="{name()}" namespace="{namespace-uri()}"/>
</xsl:template>
<xsl:template match="text()">
<a:text>
<xsl:value-of select="."/>
</a:text>
</xsl:template>
</xsl:stylesheet>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:template match="/">
<xsl:element name="w:wordDocument"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:macrosPresent"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:embeddedObjPresent"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:ocxPresent"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="xml:space" namespace="http://www.w3.org/XML/1998/namespace"/>
<xsl:text>
</xsl:text>
<xsl:element name="o:DocumentProperties"
namespace="urn:schemas-microsoft-com:office:office"/>
<xsl:text>
</xsl:text>
<xsl:element name="w:fonts"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:text>
</xsl:text>
<xsl:element name="w:defaultFonts"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:ascii"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:fareast"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:h-ansi"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:cs"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:font"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:name"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:text>
</xsl:text>
<xsl:element name="w:panose-1"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:charset"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:family"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:pitch"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:sig"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:usb-0"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:usb-1"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:usb-2"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:usb-3"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:csb-0"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:csb-1"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:font"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:name"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:text>
</xsl:text>
<xsl:element name="w:panose-1"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:charset"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:family"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:pitch"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:sig"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:usb-0"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:usb-1"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:usb-2"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:usb-3"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:csb-0"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:csb-1"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:lists"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:text>
</xsl:text>
<xsl:element name="w:listDef"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:listDefId"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:text>
</xsl:text>
<xsl:element name="w:lsid"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:plt"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:tmpl"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:lvl"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:ilvl"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:text>
</xsl:text>
<xsl:element name="w:start"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:lvlText"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:lvlJc"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:pPr"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:text>
</xsl:text>
<xsl:element name="w:ind"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:left"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:hanging"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:rPr"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:text>
</xsl:text>
<xsl:element name="w:rFonts"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:hint"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:lvl"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:ilvl"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:text>
</xsl:text>
<xsl:element name="w:start"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:lvlText"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:lvlJc"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:pPr"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:text>
</xsl:text>
<xsl:element name="w:ind"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:left"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:hanging"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:rPr"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:text>
</xsl:text>
<xsl:element name="w:rFonts"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:hint"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:lvl"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:ilvl"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:text>
</xsl:text>
<xsl:element name="w:start"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:lvlText"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:lvlJc"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:pPr"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:text>
</xsl:text>
<xsl:element name="w:tabs"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:text>
</xsl:text>
<xsl:element name="w:tab"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:pos"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:ind"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:left"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:attribute name="w:first-line"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:rPr"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:text>
</xsl:text>
<xsl:element name="w:rFonts"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:hint"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:element>
<xsl:text>
</xsl:text>
<xsl:element name="w:list"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:ilfo"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
<xsl:text>
</xsl:text>
<xsl:element name="w:ilst"
namespace="http://schemas.microsoft.com/office/word/2003/wordml">
<xsl:attribute name="w:val"
namespace="http://schemas.microsoft.com/office/word/2003/wordml"/>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:element>
<xsl:text>
</xsl:text>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Thanks for any help.
best regards
armin
-
- Site Admin
- Posts: 2095
- Joined: Thu Jan 09, 2003 2:58 pm
Re: XML to XSL Converter
The strip space elements does not work because your XML document defines xml:space="preserve" on the root element thus indicating that the whitespace is important and should be preserved. You need to specifically remove empty text nodes if that is what you want. For example you can add a template like
that will match any whitespace only text node and will not output anything for that, thus ignoring it.
Best Regards,
George
Code: Select all
<xsl:template match="text()[normalize-space(.)='']"/>
Best Regards,
George
George Cristian Bina
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service