# HG changeset patch
# User Michael Stahl <mst@openoffice.org>
# Date 1285333743 -7200
# Node ID 5d85eb5ff5bdebd835e79edbaf37b3fcc03cb911
# Parent  c5985baef1ad3a0882457182b720b59fa8fb24e7
rtftok01: move rtfactions into separate xml file

diff --git a/writerfilter/source/rtftok/makefile.mk b/writerfilter/source/rtftok/makefile.mk
--- a/writerfilter/source/rtftok/makefile.mk
+++ b/writerfilter/source/rtftok/makefile.mk
@@ -102,6 +102,7 @@
 RTFCONTROLSXSL=rtfcontrols.xsl
 
 MODELPROCESSED=rtfmodel.xml
+RTFACTIONS=rtfactions.xml
 
 GENERATEDHEADERS= \
 	$(RTFTOKENSHXX) \
@@ -136,7 +137,7 @@
 	@echo "Making:   " $(@:f)
 	$(COMMAND_ECHO)$(XSLTPROC) $(RTFTOKENTOIDXSL) $(RTFTOKENS) > $@
 
-$(RTFCONTROLSCXX): $(RTFCONTROLSXSL) $(RTFTOKENS) $(MODELPROCESSED)
+$(RTFCONTROLSCXX): $(RTFCONTROLSXSL) $(RTFTOKENS) $(MODELPROCESSED) $(RTFACTIONS)
 	@echo "Making:   " $(@:f)
 	$(COMMAND_ECHO)$(XSLTPROC) $(RTFCONTROLSXSL) $(MODELPROCESSED) > $@
 
diff --git a/writerfilter/source/rtftok/rtfactions.xml b/writerfilter/source/rtftok/rtfactions.xml
new file mode 100644
--- /dev/null
+++ b/writerfilter/source/rtftok/rtfactions.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<actions>
+  <charprops>
+    <ref name="i" tokenid="sprm:CFItalic"/>
+  </charprops>
+</actions>
diff --git a/writerfilter/source/rtftok/rtfcontrols.xsl b/writerfilter/source/rtftok/rtfcontrols.xsl
--- a/writerfilter/source/rtftok/rtfcontrols.xsl
+++ b/writerfilter/source/rtftok/rtfcontrols.xsl
@@ -67,12 +67,15 @@
 </xsl:text>
 
     <!-- stuff -->
-    <xsl:for-each select="/out/charprops/ref">
+    <xsl:for-each select="document('rtfactions.xml')/actions/charprops/ref">
       <xsl:variable name="name">
           <xsl:value-of select="@name"/>
       </xsl:variable>
       <xsl:variable name="type">
-          <xsl:value-of select="name(key('names', @name))" />
+        <!-- hack: context must be in model document, to make key work -->
+        <xsl:for-each select="document('rtfmodel.xml')/out">
+          <xsl:value-of select="name(key('names', $name))" />
+        </xsl:for-each>
       </xsl:variable>
       <xsl:variable name="token">
         <xsl:choose>
@@ -96,8 +99,11 @@
         <xsl:when test="$type='value'">
         </xsl:when>
         <xsl:otherwise>
-          <xsl:text>ERROR: type is:</xsl:text>
+          <xsl:text>#error token: </xsl:text>
+          <xsl:value-of select="@name"/>
+          <xsl:text> type is:</xsl:text>
           <xsl:value-of select="$type"/>
+          <xsl:text>&#xA;</xsl:text>
         </xsl:otherwise>
       </xsl:choose>
       <xsl:choose>
