| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:Types__x3A__xlsx="https://biuro.biall-net.pl/wfs/default_db/Types/xlsx.xsd"
- xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
- xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:dcterms="http://purl.org/dc/terms/"
- xmlns:dcmitype="http://purl.org/dc/dcmitype/"
- xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
- xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- exclude-result-prefixes="xs"
- version="2.0">
-
- <xsl:output indent="yes"/>
- <xsl:strip-space elements="*"/>
- <xsl:param name="Types__x3A__xlsx__x3A__unzipped_xlsx" required="yes"/> <!-- type dir there to unzipped dir of xlsx file -->
-
-
-
-
- <xsl:variable name="Types__x3A__xlsx:path">
- <!-- <xsl:for-each select="collection(iri-to-uri('../someDir/?select=[a-z][0-9]+.(xsl|xslt);recurse=yes'))"> -->
- <xsl:message> Looking for xml doc files at <xsl:value-of select=" iri-to-uri(concat($Types__x3A__xlsx__x3A__unzipped_xlsx,'?select=*.(xml|rels);recurse=yes;on-error=warning'))"/></xsl:message>
- <xsl:value-of select=" iri-to-uri(concat($Types__x3A__xlsx__x3A__unzipped_xlsx,'?select=*.(xml|rels);recurse=yes;on-error=warning'))"/>
- </xsl:variable>
-
- <xsl:variable name="Types__x3A__xlsx:docs" select="collection($Types__x3A__xlsx:path)"/>
-
-
-
- <xsl:template name="Types__x3A__xlsx:main">
- <xsl:message>Executing Types__x3A__xlsx__x3A__main</xsl:message>
- <Types__x3A__xlsx:main>
-
- <xsl:for-each select="$Types__x3A__xlsx:docs">
- <xsl:apply-templates mode="Types__x3A__xlsx:sheets">
- <xsl:with-param name="document-uri" select="document-uri(/)"/>
- </xsl:apply-templates>
- </xsl:for-each>
- </Types__x3A__xlsx:main>
- </xsl:template>
-
-
- <xsl:template match="*">
- <xsl:message terminate="yes">ERROR this template should be called by call-template</xsl:message>
- </xsl:template>
-
- <xsl:template match="workbook" mode="Types__x3A__xlsx:sheets" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main" >
- <xsl:param name="document-uri"/>
-
- <workbook>
- <xsl:attribute name="document-uri" select="$document-uri"/>
-
- <xsl:copy-of select="sheets"/>
- <!--<xsl:for-each select="sheets/sheet" > <!-\- xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main" -\->
- <xsl:apply-templates mode="Types__x3A__xlsx:sheet" select="$Types__x3A__xlsx:docs">
- <xsl:with-param name="document-uri" select="$document-uri"/>
- <xsl:with-param name="name" select="@name"/>
- <xsl:with-param name="sheetId" select="@sheetId"/>
- <xsl:with-param name="r:id" select="@r:id"/>
- <xsl:with-param name="sheet_name" select="$sheet_names//sheet[@sheetId = current()/@sheetId]/@name"/>
- </xsl:apply-templates>
- </xsl:for-each>-->
-
-
- <!--<xsl:for-each select="sheets/sheet" >--> <!-- xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main" -->
- <xsl:apply-templates mode="Types__x3A__xlsx:sheets" >
- <xsl:with-param name="document-uri" select="$document-uri"/>
- <xsl:with-param name="name" select="@name"/>
- <xsl:with-param name="sheetId" select="@sheetId"/>
- <xsl:with-param name="r:id" select="@r:id"/>
- <!--<xsl:with-param name="sheet_name" select="$sheet_names//sheet[@sheetId = current()/@sheetId]/@name"/>-->
- </xsl:apply-templates>
- <!--</xsl:for-each>-->
- </workbook>
- </xsl:template>
-
-
-
- <xsl:template match="*" mode="Types__x3A__xlsx:sheets Types__x3A__xlsx:sheet">
- <xsl:param name="document-uri"/>
- <!--<bypassed_86>
- <xsl:copy-of select="."/>
- </bypassed_86>-->
- <xsl:comment>#86 bypassed <xsl:value-of select="name()"/>
- <xsl:text>
- </xsl:text>
- <xsl:element name="{name()}">
- <xsl:copy-of select="@*"/>
- <name><xsl:value-of select="name()"/></name>
- <url><xsl:value-of select="$document-uri"/></url>
- </xsl:element>
- </xsl:comment>
- </xsl:template>
-
-
- <!--<xsl:template match="worksheet" mode="Types__x3A__xlsx:sheet">
- <xsl:param name="document-uri"/>
- <!-\-<bypassed_86>
- <xsl:copy-of select="."/>
- </bypassed_86>-\->
- <xsl:comment>#86 bypassed <xsl:value-of select="name()"/>
- <xsl:text>
- </xsl:text>
- <xsl:element name="{name()}">
- <xsl:copy-of select="@*"/>
- <name><xsl:value-of select="name()"/></name>
- <url><xsl:value-of select="$document-uri"/></url>
- </xsl:element>
- </xsl:comment>
- </xsl:template>-->
-
-
-
- <xsl:template match="worksheet" mode="Types__x3A__xlsx:sheets" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
- <!--<xsl:param name="sheetId" required="yes"/>-->
- <xsl:param name="name"/>
- <xsl:param name="document-uri" select="document-uri(/)"/>
-
-
-
- <!--<xsl:variable name="sheet_id" select="replace(replace(substring-after(document-uri(/),'/worksheets/'),'.xml',''),'sheet','')"/>-->
- <xsl:variable name="document-uri-after" select="substring-after( document-uri(/),'worksheets/')"/>
-
- <xsl:variable name="sheet_id" select="$Types__x3A__xlsx:docs/Relationships/Relationship[ contains(@Target,concat('/',$document-uri-after))]/@Id" xpath-default-namespace="http://schemas.openxmlformats.org/package/2006/relationships"/>
-
- <xsl:variable name="sheet_name" select="$Types__x3A__xlsx:docs/workbook/sheets/sheet[@r:id = $sheet_id ]/@name" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main" />
-
- <xsl:comment>#102 worksheet=<xsl:value-of select="$document-uri"/>; $document-uri-after=<xsl:value-of select="$document-uri-after"/>; $sheet_id=<xsl:value-of select="$sheet_id"/>;</xsl:comment>
- <!--<DEBUG.131>
- <xsl:copy-of select="$Types__x3A__xlsx:docs/Relationships" xpath-default-namespace="http://schemas.openxmlformats.org/package/2006/relationships"/>
- </DEBUG.131>-->
-
- <!-- <xsl:choose>
- <xsl:when test=" substring-after( document-uri(/),'worksheets/')=concat('sheet',$sheetId,'.xml')">-->
- <xsl:apply-templates mode="Types__x3A__xlsx:sheetData">
- <xsl:with-param name="sheet_name" select="$sheet_name"/>
- </xsl:apply-templates>
- <!-- </xsl:when>
- <xsl:otherwise>
- <xsl:comment>
- <inny_sheet><xsl:attribute name="sheetId_param" select="$sheetId"/>
- <xsl:value-of select="substring-after( document-uri(/),'worksheets/')"/>
- <test><xsl:value-of select="concat('sheet',$sheetId,'.xml')"/></test>
- </inny_sheet>
- </xsl:comment>
- </xsl:otherwise>
- </xsl:choose>-->
- </xsl:template>
-
-
- <xsl:template match="sheetData" mode="Types__x3A__xlsx:sheetData" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
- <xsl:param name="sheet_name" required="yes"/>
- <sheetData>
- <xsl:attribute name="sheet_name" select="$sheet_name"/>
- <xsl:attribute name="document-uri" select="substring-after( document-uri(/),'worksheets/')"/>
- <xsl:attribute name="sheetId" select="@sheetId"/>
- <xsl:attribute name="r:id" select="@r:id"/>
- <xsl:apply-templates mode="Types__x3A__xlsx:sheetData"/>
- </sheetData>
- </xsl:template>
-
- <!--<xsl:template match="row[ count(c) < 2 and position() = 1]" mode="Types__x3A__xlsx:sheetData" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
- <xsl:comment>#154 bypassed by row[ count(c) < 2] - todo unknown structure</xsl:comment>
- <xsl:message>#154 TODO WARNING bypassed by row[ count(c) < 2] - todo unknown structure</xsl:message>
- </xsl:template>-->
-
- <xsl:template match="row" mode="Types__x3A__xlsx:sheetData" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
- <row>
- <xsl:copy-of select="@r"/>
- <xsl:apply-templates mode="Types__x3A__xlsx:sheetData"/>
- </row>
- </xsl:template>
-
- <xsl:template match="c[@t='s']" mode="Types__x3A__xlsx:sheetData" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
- <xsl:variable name="v" select="number(v/text())"/>
- <xsl:variable name="r" select="@r"/>
- <c><xsl:copy-of select="@*"/>
- <xsl:attribute name="v_deb_nr" select="$v"/>
- <xsl:attribute name="col" select=" replace(@r,'([0-9])','')"/>
- <v><xsl:value-of select="$Types__x3A__xlsx:docs/sst/si[position()=($v + 1)]/t" exclude-result-prefixes="#all"/></v>
- <!--<xsl:copy-of select="../../../hyperlinks/hyperlink"/>-->
- <xsl:apply-templates mode="Types__x3A__xlsx:Hyperlink" select="../../../hyperlinks/hyperlink[@ref=current()/@r]" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main"/>
- </c>
- </xsl:template>
-
- <xsl:template match="c" mode="Types__x3A__xlsx:sheetData" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
- <xsl:variable name="r" select="@r"/>
- <c><xsl:copy-of select="@*"/>
- <xsl:attribute name="col" select=" replace(@r,'([0-9])','')"/>
- <v><xsl:copy-of select="v/text()" copy-namespaces="no"/></v>
- <xsl:apply-templates mode="Types__x3A__xlsx:Hyperlink" select="../../../hyperlinks/hyperlink[@ref=current()/@r]"/>
- </c>
- </xsl:template>
-
-
-
- <xsl:template match="hyperlink" mode="Types__x3A__xlsx:Hyperlink" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
- <!--<xsl:value-of select="@r:id"/>-->
- <!--<xsl:copy-of select="$Types__x3A__xlsx:docs" xpath-default-namespace="http://schemas.openxmlformats.org/package/2006/relationships"/>-->
- <xsl:copy-of select="$Types__x3A__xlsx:docs/Relationships/Relationship[@Id=current()/@r:id]" xpath-default-namespace="http://schemas.openxmlformats.org/package/2006/relationships"/>
- </xsl:template>
-
- </xsl:stylesheet>
|