How each table separately in XSLT filter ?

Here should go questions about transforming XML with XSLT and FOP.
Posts: 1
Joined: Mon May 14, 2018 8:02 pm

How each table separately in XSLT filter ?

Post by quotsi » Mon May 14, 2018 8:29 pm

I am writing/testing a short XSLT export filter transforming a OpenOffice calc file return to a XML file for reimport to "boso profile manager XD".
The calc file has 3 (or more) tables, first or patients name etc., the further for each date-time intervall with the values.
My filter program is not complete and correct. I can not separate the tables so that I can not distinguish between patient name etc. and the values.
How can I separate the tables?
Thanks for help.

My XSLT filter:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!-- We must define several namespaces, because we need them to access -->
<!-- the document model of the in-memory document. -->
<!-- If we want to access more parts of the document model, we must-->
<!-- add there namesspaces here, too. -->
<xsl:stylesheet version="1.0" xmlns:xsl=""
exclude-result-prefixes="office table text">
<xsl:output method = "xml" indent = "yes" encoding = "UTF-8" omit-xml-declaration = "no"/>
<!-- By setting the PropertyValue "URL" in the properties used in storeToURL(), -->
<!-- we can pass a single parameter to this stylesheet. -->
<!-- Caveat: If we use the "URL" property in the stylesheet and call in OOo -->
<!-- from the menu "File" > "Export...", OOo assigns a target URL. And that -->
<!-- might not be what we want. -->
<xsl:param name="targetURL"/>
<!-- Process the document model -->
<xsl:template match="/">
<!-- Process all tables -->
<xsl:apply-templates select="//table:table"/>
<xsl:template match="table:table">
<xsl:for-each select="table:table-row">
<xsl:if test="position()=2">
<xsl:for-each select="table:table-cell">
<xsl:when test="position()=1">
<pa_no><xsl:value-of select="text:p"/></pa_no>
<xsl:when test="position()=2">
<pa_name><xsl:value-of select="text:p"/></pa_name>
<xsl:when test="position()=3">
<pa_prename><xsl:value-of select="text:p"/></pa_prename>
<xsl:when test="position()=4">
<pa_gender><xsl:value-of select="text:p"/></pa_gender>
<xsl:when test="position()=5">
<pa_birthday><xsl:value-of select="text:p"/></pa_birthday>
<xsl:when test="position()=6">
<pa_insurance_no><xsl:value-of select="text:p"/></pa_insurance_no>
<xsl:when test="position()=7">
<pa_size><xsl:value-of select="text:p"/></pa_size>
<xsl:when test="position()=8">
<pa_weight><xsl:value-of select="text:p"/></pa_weight>
<xsl:when test="position()=9">
<pa_street><xsl:value-of select="text:p"/></pa_street>
<xsl:when test="position()=10">
<pa_zip><xsl:value-of select="text:p"/></pa_zip>
<xsl:when test="position()=11">
<pa_city><xsl:value-of select="text:p"/></pa_city>
<xsl:when test="position()=12">
<pa_remarks xml:space="preserve"><xsl:value-of select="text:p"/></pa_remarks>