# HG changeset patch
# User Henning Brinkmann <hbrinkm@openoffice.org>
# Date 1282750853 -7200
# Node ID 6c54fb8aa184c7d78cbc900719807d65ccaef54b
# Parent  e8b9206324e018baa890b2ed1e476117a88578cf
rtftok01: simplify output of spectobnf.xsl

diff --git a/writerfilter/source/rtftok/bnfsimplify.xsl b/writerfilter/source/rtftok/bnfsimplify.xsl
new file mode 100644
--- /dev/null
+++ b/writerfilter/source/rtftok/bnfsimplify.xsl
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" 
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" omit-xml-declaration="no"/>
+
+<!-- identity template -->
+<xsl:template match="@*|node()">
+    <xsl:copy>
+        <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+</xsl:template>
+
+<xsl:template name="flatchoice">
+  <xsl:for-each select="choice">
+    <xsl:call-template name="flatchoice"/>
+  </xsl:for-each>
+  <xsl:for-each select="*[not(self::choice)]">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="choice">
+  <xsl:copy>
+    <xsl:call-template name="flatchoice"/>
+  </xsl:copy>
+</xsl:template>
+
+<xsl:template name="flatany">
+  <xsl:for-each select="any">
+    <xsl:call-template name="flatany"/>
+  </xsl:for-each>
+  <xsl:for-each select="*[not(self::any)]">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:for-each>
+</xsl:template>
+
+<xsl:template match="any">
+  <xsl:copy>
+    <xsl:call-template name="flatany"/>
+  </xsl:copy>
+</xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
