IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

Working with Word XSLT Template Options · View
Techteam
Posted: Tuesday, June 18, 2013 11:26:01 AM
Rank: Member

Joined: 5/4/2010
Posts: 21
Location: D
Hi,
Since some years we are using StyleVison to generate the xslt templates for html, pdf and docx files to produce reports over a java application with saxon and fop.
This works well for html and pdf.

And with the old templates of StyleVision 2009 it works also halfway well for MS Word docx files.

Now we have to do some changes inside the reports and I use the current StyleVision 2013 rel2 EE to update these, but the only thing I get now are errors.

1. My own updated template on saxon:
Error at xsl:variable on line 1781 column 300 of Testdocx.xslt:
XPTY0020: Axis step child::element(Q{}Class) cannot be used here: the context item is not a node
Error at xsl:variable on line 1795 column 312 of Testdocx.xslt:
XPTY0020: Axis step child::element(Q{}Class) cannot be used here: the context item is not a node
Error on line 1781 of Testdocx.xslt:
XPTY0020: Axis step child::element(Q{}Class) cannot be used here: the context item is not a node
Error on line 1795 of Testdocx.xslt:
XPTY0020: Axis step child::element(Q{}Class) cannot be used here: the context item is not a node

1781:
<xsl:variable name="nodeClassInfo" select="if (altova:CharacterProperties/altova:DynamicClass) then $altova:nodeCssClasses/Class[@sSelector eq current()/altova:CharacterProperties/altova:DynamicClass/@sValue and ($altova:sCssSwitch eq '' or @sFile eq $altova:sCssSwitch)] else ()" as="node()*"/>

1795:
<xsl:variable name="nodeClassInfo" select="if ($nodePassed/altova:ParagraphProperties/altova:DynamicClass) then $altova:nodeCssClasses/Class[@sSelector eq $nodePassed/altova:ParagraphProperties/altova:DynamicClass/@sValue and ($altova:sCssSwitch eq '' or @sFile eq $altova:sCssSwitch)] else ()" as="node()*"/>

2. The Example QuickStart.xml with a generated xslt template from the sps on saxon:
Warning: on line 215 of Quickstart.xslt:
Required item type of first argument of month-from-date() is xs:date; supplied value has
item type xs:double. The expression can succeed only if the supplied value is an empty sequence.
Warning: on line 215 of Quickstart.xslt:
Required item type of first argument of year-from-date() is xs:date; supplied value has
item type xs:double. The expression can succeed only if the supplied value is an empty sequence.
Warning: on line 215 of Quickstart.xslt:
Required item type of first argument of month-from-date() is xs:date; supplied value has
item type xs:double. The expression can succeed only if the supplied value is an empty sequence.
Warning: on line 215 of Quickstart.xslt:
Required item type of first argument of year-from-date() is xs:date; supplied value has
item type xs:double. The expression can succeed only if the supplied value is an empty sequence.
Warning: on line 215 of Quickstart.xslt:
The only value that can pass type-checking is an empty sequence. Required item type of
first argument of month-from-date() is xs:date; supplied value has item type xs:double
Warning: on line 215 of Quickstart.xslt:
The only value that can pass type-checking is an empty sequence. Required item type of
first argument of year-from-date() is xs:date; supplied value has item type xs:double
Warning: on line 215 of Quickstart.xslt:
The only value that can pass type-checking is an empty sequence. Required item type of
first argument of month-from-date() is xs:date; supplied value has item type xs:double
Warning: on line 215 of Quickstart.xslt:
The only value that can pass type-checking is an empty sequence. Required item type of
first argument of year-from-date() is xs:date; supplied value has item type xs:double
Error on line 215 of Quickstart.xslt:
FORG0001: Failure converting {2006-04-01} to a number
in variable altova:DocumentMonolith
in variable altova:nodesAllSeparateDocuments
; SystemID: file:/T:/Quickstart.xslt; Line#: 215; Column#: -1
net.sf.saxon.trans.XPathException: Failure converting {2006-04-01} to a number

3. The Example QuickStart.xml with a generated xslt template from the sps on RaptorXMLDev:
OK - saxon doesn't want - I try the same with the RaptorXMLDev.
It runs withot erros but I've got no output.

RaptorXMLDev.exe" xslt --input=T:\QuickStart.xml --output=T:\QuickOut.xml T:\QuickStart.xsltarguments: ["T:\\QuickStart.xslt"]

options: {"xslt.in": ["T:\\QuickStart.xml"], "chartextension.security_disable":
false, "xslt.out": ["T:\\QuickOut.xml"], "application.globalresources": false, "
common.load_xml_with_psvi": true, "core.linenumbers": true, "core.error_limit":
100, "core.timing": false, "core.verbose": false, "dotnetextension.security_disa
ble": false, "javaextension.security_disable": false, "xsd.import_strategy": "lo
ad-preferring-schemalocation", "xsd.mapping_strategy": "prefer-schemalocation",
"xsd.version": "1.0", "xsd.xinclude_support": false, "xsd.xml_validation_mode":
"wf", "xsd.xsi_schemaLocation_strategy": "load-by-schemalocation", "xslt.engine_
version": 3, "xslt.streaming_serialization_enabled": true, "chartextension.licen
se_disable": true}
file:///T:/QuickStart.xml: result="OK" xslt-output-files="file:///T:/QuickOut.do
cx%7Czip/word/document.xml file:///T:/QuickOut.docx%7Czip/word/Section_5_HeaderD
efault.xml file:///T:/QuickOut.docx%7Czip/word/Section_5_FooterDefault.xml file:
///T:/QuickOut.docx%7Czip/word/styles.xml file:///T:/QuickOut.docx%7Czip/word/nu
mbering.xml file:///T:/QuickOut.docx%7Czip/%5BContent_Types%5D.xml file:///T:/Qu
ickOut.docx%7Czip/_rels/.rels file:///T:/QuickOut.docx%7Czip/word/_rels/document
.xml.rels file:///T:/QuickOut.docx%7Czip/word/_rels/Section_5_HeaderDefault.xml.
rels file:///T:/QuickOut.docx%7Czip/word/_rels/Section_5_FooterDefault.xml.rels
file:///T:/QuickOut.docx%7Czip/word/settings.xml file:///T:/QuickOut.docx%7Czip/
word/media/image1.BMP file:///T:/QuickOut.docx%7Czip/docProps/core.xml"

Now my big questions:
How or with xslt processor can be used to transform xml with the MS Word XSLT templates?
Has anyone experience with the Word templates?

Thanks in advance
Heiko



vlad
Posted: Tuesday, June 18, 2013 11:30:37 AM
Rank: Advanced Member

Joined: 12/13/2005
Posts: 2,856
Location: Mauritius
Are you using Altova or some foreign XSLT processor to transfer files? I'm asking, because support for DOCX files, which are ZIP files internally, can only be implemented by every vendor independently, because it is not part of XSLT standard.
Techteam
Posted: Tuesday, June 18, 2013 11:43:19 AM
Rank: Member

Joined: 5/4/2010
Posts: 21
Location: D
Untill now we are using the java version of Saxon (http://sourceforge.net/projects/saxon/)
And with the 2009er version we build our own docx container around the transfromation output.

But now there are errors on saxon before I've got any output.
vlad
Posted: Tuesday, June 18, 2013 12:04:45 PM
Rank: Advanced Member

Joined: 12/13/2005
Posts: 2,856
Location: Mauritius
Well, I'm surprised that this ever worked with Saxon. As I said, because of the requirement to write to a ZIP format, which is not included in XSLT standard, you have to use Altova engine.

And now, as Altova has released RaptorXML for all platforms, there is no reason to use anything else.
Techteam
Posted: Wednesday, June 19, 2013 7:16:56 AM
Rank: Member

Joined: 5/4/2010
Posts: 21
Location: D
Hi vlad,
thanks for your answers.

I do some more test with RaptoXML and saxon, I have some success.

On RaptorXML:
If you uses even a MS Word xslt template from StyleVision, the output option must be not a file, it must be a directory, where into this RaptorXML generate all files.
RaptorXMLDev.exe" xslt --input=T:\QuickStart.xml --output=T:\QuickOutputFOLDER T:\QuickStart.xslt

So it seems, raptor doesn't create docx (zip) files himself, or do I have to set some special properties for this????


On saxon:
After some modifications on the generated MS Word xslt template of the QuickStart example , at the criticized "date method" and add a special jar with an charset implementation for the xslt "binarytobase64" function (Used to embed images), saxon does also generate all the files into the target directory.

The xslt based on the my updated sps file, doesn't work, at the moment, but I will try to rebuild the report and maybe than it will work.



Using a central RaptorXML and/or FlowServer solution, will have some charm, but before I can propose this to my bosses, there are two things to check / must be working.
- I have to evaluate, how does the java interface works and what I've got as result (especially in conjunction with the word templates) there.
- My big problem is with the creation of templates with StyleVision itself. The generated MS Word XSLT templates produces the final documents within his own style defintions and do not use any existing default, for example the headings.
The documents produced by our process but usually provide only a fraction of a complete document and the complete document must be in a corporate design.
In consequence of this proportion must in transferring data from one document to another, are always reformatted by hand.

A nice solution would be if you can assign a CSS file analogous to the html generation for MS Word (pdf) generation could assign a Word template.

Greetings
Heiko
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.