| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <?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"
- 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: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="name" select="@name"/>
- <xsl:with-param name="sheetId" select="@sheetId"/>
- <xsl:with-param name="r:id" select="@r:id"/>
- </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"/>
- <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:template>
-
-
-
- <xsl:template match="worksheet" mode="Types__x3A__xlsx:sheet" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
- <xsl:param name="sheetId" required="yes"/>
- <xsl:param name="name"/>
- <xsl:choose>
- <xsl:when test=" substring-after( document-uri(/),'worksheets/')=concat('sheet',$sheetId,'.xml')">
- <xsl:apply-templates mode="Types__x3A__xlsx:sheetData"/>
- </xsl:when>
- <xsl:otherwise>
- <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:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- <xsl:template match="sheetData" mode="Types__x3A__xlsx:sheetData" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
- <sheetData>
- <xsl:apply-templates mode="Types__x3A__xlsx:sheetData"/>
- </sheetData>
- </xsl:template>
-
- <xsl:template match="row" mode="Types__x3A__xlsx:sheetData" xpath-default-namespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
- <row>
- <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="v/text()"/>
- <xsl:variable name="r" select="@r"/>
- <c><xsl:copy-of select="@*"/><xsl:attribute name="v_deb_nr" select="$v"/>
- <v><xsl:value-of select="$Types__x3A__xlsx:docs/sst/si[position()=$v]/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="@*"/>
- <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>
|