| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387 |
- <?xml version="1.0" encoding="UTF-8"?>
- <xsl:stylesheet xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
- xmlns:xs="http://www.w3.org/2001/XMLSchema"
- xmlns:p5bws="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/WPS_Functions.xsd"
- xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
- xmlns:p5dkp="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.xsd"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:p5suis="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/system_ui_info_speech/system_ui_info_speech.xsd"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/"
- exclude-result-prefixes="xs vc p5bws system_cache__appinfo p5suis p5dkp ditaarch xsi"
- version="2.0">
- <!--<xsl:output indent="yes" method="xml" standalone="no" doctype-public="-//OASIS//DTD DITA Topic//EN" doctype-system="topic.dtd"/>-->
- <xsl:output indent="yes" />
- <xsl:strip-space elements="*"/>
-
- <!--<xsl:variable name="debug" select="99"/>-->
-
- <xsl:template mode="p5dkp:fix-topic" match="topic">
- <xsl:param name="keyscope" required="yes"/>
- <xsl:param name="map.path" required="yes"/>
- <xsl:param name="keyscope.attr" required="yes"/>
- <xsl:param name="keydef" required="yes"/>
- <xsl:param name="href" required="yes"/>
- <p5dkp:fix-topic>
- <xsl:attribute name="map.path" select="$map.path"/>
- <xsl:choose>
- <xsl:when test="$debug">
- <xsl:copy-of select="@*"/>
- <keyscope.attr>
- <xsl:copy-of select="$keyscope.attr"/>
- </keyscope.attr>
- <keydef>
- <xsl:copy-of select="$keydef"/>
- </keydef>
- <keyscope>
- <xsl:copy-of select="$keyscope"/>
- </keyscope>
- <href>
- <xsl:value-of select="$href"/>
- </href>
- </xsl:when>
- </xsl:choose>
-
-
- <xsl:variable name="context" select="."/>
- <xsl:variable name="max_keyscope" select="max($keyscope//key/string-length(text()))"/>
- <!--<max_keyscope>
- <xsl:value-of select="$max_keyscope"/>
- </max_keyscope>-->
- <xsl:for-each select="$keyscope//key">
- <xsl:choose>
- <xsl:when test="string-length(.) = $max_keyscope">
- <xsl:for-each select="tokenize( . , '\.')">
- <xsl:choose>
- <xsl:when test="position() = 1">
- <xsl:choose>
- <xsl:when test="current() = 'role'">
- <xsl:variable name="p5dkp:fix-topic.role">
- <xsl:apply-templates mode="p5dkp:fix-topic.role" select="$context">
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="keyscope" select="$keyscope"/>
- </xsl:apply-templates>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$p5dkp:fix-topic.role//comment()">
- <p5suis:say> Fixed dita to copy <xsl:value-of select="$href"/></p5suis:say>
- <xsl:message>#65 Fixed dita to copy <xsl:value-of select="$map.path"/>/<xsl:value-of select="$href"/> </xsl:message>
- <xsl:result-document href="{$map.path}/{$href}.fixed">
- <xsl:copy-of select="$p5dkp:fix-topic.role"/>
- </xsl:result-document>
- </xsl:when>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="current() = 'wymagania'">
-
- <xsl:variable name="p5dkp:fix-topic.wymagania">
- <xsl:apply-templates mode="p5dkp:fix-topic.wymagania" select="$context">
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="keyscope" select="$keyscope"/>
- </xsl:apply-templates>
- </xsl:variable>
- <!--<TRY_WYMAGANIA>
- <TEST>
- <xsl:copy-of select="$p5dkp:fix-topic.wymagania"/>
- </TEST>
- <CONTEXT>
- <xsl:copy-of select="$context"/>
- </CONTEXT>
- </TRY_WYMAGANIA>-->
- <xsl:choose>
- <xsl:when test="$p5dkp:fix-topic.wymagania//comment()">
- <p5suis:say> Fixed dita to copy <xsl:value-of select="$href"/></p5suis:say>
- <xsl:message>#82 Fixed dita to copy <xsl:value-of select="$map.path"/>/<xsl:value-of select="$href"/> </xsl:message>
- <xsl:choose>
- <xsl:when test="doc-available(concat($map.path,'/',$href,'.fixed'))">
- <xsl:message>#102 DOCUMENT EXISTS - should bbefore go clean! <xsl:value-of select="$href"/>.fixed !!</xsl:message>
- </xsl:when>
- <xsl:otherwise>
- <xsl:result-document href="{$map.path}/{$href}.fixed">
- <xsl:copy-of select="$p5dkp:fix-topic.wymagania"/>
- </xsl:result-document>
-
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:when>
- </xsl:choose>
- </xsl:when>
-
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </p5dkp:fix-topic>
- </xsl:template>
-
-
-
- <xsl:template mode="p5dkp:fix-topic.role p5dkp:fix-topic.wymagania" match="*">
- <xsl:param name="keyscope" required="yes"/>
- <xsl:param name="keydef" required="yes"/>
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates mode="#current">
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="keyscope" select="$keyscope"/>
- </xsl:apply-templates>
- </xsl:copy>
- </xsl:template>
-
-
-
- <!--<xsl:template mode="p5dkp:fix-topic.role p5dkp:fix-topic.wymagania" match="*">
- <xsl:param name="keyscope" required="yes"/>
- <xsl:param name="keydef" required="yes"/>
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates mode="#current">
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="keyscope" select="$keyscope"/>
- </xsl:apply-templates>
- </xsl:copy>
- </xsl:template>-->
-
-
- <xsl:template mode="p5dkp:fix-topic.role p5dkp:fix-topic.wymagania" match="body[preceding-sibling::title[ ph[@keyref='wymagania_no'] ]]" priority="9">
- <xsl:message>#140 bypassing due to topic specyfing keys in custom style </xsl:message>
- </xsl:template>
-
- <xsl:template mode="p5dkp:fix-topic.role" match="body[ not( p ) or not(p[table]) ]">
- <xsl:param name="keyscope" required="yes"/>
- <xsl:param name="keydef" required="yes"/>
- <xsl:message>#73 TO FIX <xsl:value-of select="@*"/></xsl:message>
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:comment>#80 FIX FIX</xsl:comment>
- <p>
- <table>
- <tgroup cols="3">
- <thead>
- <row>
- <entry>role</entry>
- <entry>descr</entry>
- <entry>cost month</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry><ph keyref="{$keyscope//key[ position() = last()]/text()}.role_no"/></entry>
- <entry><ph keyref="{$keyscope//key[ position() = last()]/text()}.role_desc"/></entry>
- <entry><ph keyref="{$keyscope//key[ position() = last()]/text()}.role_price"/></entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </p>
-
- <xsl:apply-templates mode="#current">
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="keyscope" select="$keyscope"/>
- </xsl:apply-templates>
- </xsl:copy>
- </xsl:template>
-
- <xsl:function name="p5dkp:max_keyscope.pos">
- <xsl:param name="p5dkp:keyscope"/>
- <xsl:variable name="max_keyscope" select="max($p5dkp:keyscope//key/string-length(text()))"/>
- <xsl:for-each select="$p5dkp:keyscope//key">
- <xsl:if test="string-length(text()) = $max_keyscope">
- <xsl:value-of select="position()"/>
- </xsl:if>
- </xsl:for-each>
- </xsl:function>
-
- <xsl:function name="p5dkp:max_keyscope.get">
- <xsl:param name="p5dkp:keyscope"/>
- <xsl:param name="p5dkp:max_keyscope.pos"/>
- <xsl:if test="number($debug) > 4"><xsl:message>#190 $p5dkp:max_keyscope.pos = <xsl:value-of select="$p5dkp:max_keyscope.pos"/>
- <xsl:copy-of select="$p5dkp:keyscope//key[round($p5dkp:max_keyscope.pos)]" copy-namespaces="no"/>
- </xsl:message></xsl:if>
- <xsl:choose>
- <xsl:when test="contains($p5dkp:keyscope//key[ round($p5dkp:max_keyscope.pos)]/text(),' ')">
- <xsl:for-each select="tokenize($p5dkp:keyscope//key[ round($p5dkp:max_keyscope.pos)]/text(),' ')[1]">
- <xsl:value-of select="."/>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="$p5dkp:keyscope//key[ round($p5dkp:max_keyscope.pos)]/text()"/></xsl:otherwise>
- </xsl:choose>
- </xsl:function>
-
- <xsl:template mode="p5dkp:fix-topic.wymagania" match="body[ not( p ) or not(p[simpletable]) ]">
- <xsl:param name="keyscope" required="yes"/>
- <xsl:param name="keydef" required="yes"/>
- <xsl:message>#167 TO FIX <xsl:value-of select="@*"/></xsl:message>
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <xsl:comment>#167 FIX FIX</xsl:comment>
- <p>
- <simpletable frame="all" relcolwidth="1* 1* 1* 1* 1* 1*" >
- <sthead>
- <stentry>Przydzielona rola</stentry>
- <stentry>Opis Zadanis</stentry>
- <stentry>Koszt</stentry>
- <stentry>nakład godzin</stentry>
- <stentry>wymiar czasu</stentry>
- <stentry>etap</stentry>
- </sthead>
- <strow>
- <!--<xsl:variable name="max_keyscope" select="max($keyscope//key/string-length(text()))"/>
- <xsl:variable name="max_keyscope.pos">
- <xsl:for-each select="$keyscope//key">
- <xsl:if test="string-length(text()) = $max_keyscope">
- <xsl:value-of select="position()"/>
- </xsl:if>
- </xsl:for-each>
- </xsl:variable>-->
- <xsl:variable name="max_keyscope.pos" select="p5dkp:max_keyscope.pos($keyscope)"/>
-
- <stentry><xref keyref="{p5dkp:max_keyscope.get($keyscope,$max_keyscope.pos)}.role_no"/>
- <!--<ph keyref="wymagania.ogolne.harmonotram.role_no"/>--></stentry>
- <stentry>
- <ph keyref="{p5dkp:max_keyscope.get($keyscope,$max_keyscope.pos)}.role_desc"/></stentry>
- <stentry>
- <ph keyref="{p5dkp:max_keyscope.get($keyscope,$max_keyscope.pos)}.role_price"/>
- </stentry>
- <stentry>
- <ph keyref="{p5dkp:max_keyscope.get($keyscope,$max_keyscope.pos)}.role_time"/>
- </stentry>
- <stentry>
- <ph keyref="{p5dkp:max_keyscope.get($keyscope,$max_keyscope.pos)}.role_price_recur"/>
- </stentry>
- <stentry>
- <ph keyref="{p5dkp:max_keyscope.get($keyscope,$max_keyscope.pos)}.etap_no"/>
- </stentry>
-
-
- </strow>
- </simpletable>
- </p>
-
-
- <xsl:apply-templates mode="#current">
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="keyscope" select="$keyscope"/>
- </xsl:apply-templates>
- </xsl:copy>
- </xsl:template>
-
- <!--<xsl:template mode="p5dkp:fix-topic.role" match="title">
- <TITLE>
- <xsl:value-of select="ph[ not( contains(@keyref,'role.'))]"/>
- </TITLE>
- </xsl:template>-->
-
- <xsl:template mode="p5dkp:fix-topic.role" match="title[ ph[ not( contains(@keyref,'role.'))] ]">
- <xsl:param name="keyscope" required="yes"/>
- <xsl:param name="keydef" required="yes"/>
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <!--<FIX>-->
- <xsl:apply-templates mode="p5dkp:fix-topic.role.title">
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="keyscope" select="$keyscope"/>
- </xsl:apply-templates>
- <!--</FIX>-->
- </xsl:copy>
- </xsl:template>
-
- <xsl:template mode="p5dkp:fix-topic.wymagania" match="title[ ph[ contains(@keyref,'map.descr')] ]">
- <xsl:param name="keyscope" required="yes"/>
- <xsl:param name="keydef" required="yes"/>
- <xsl:copy>
- <xsl:copy-of select="@*"/>
- <!--<FIX1111>-->
- <xsl:apply-templates mode="p5dkp:fix-topic.wymagania.title">
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="keyscope" select="$keyscope"/>
- </xsl:apply-templates>
- <!--</FIX1111>-->
- </xsl:copy>
- </xsl:template>
-
- <xsl:template mode="p5dkp:fix-topic.role.title p5dkp:fix-topic.wymagania.title" match="text()">
- <xsl:copy-of select="."/>
- </xsl:template>
-
- <xsl:template mode="p5dkp:fix-topic.role.title" match="ph[contains(@keyref,'map.descr.')]">
- <xsl:param name="keyscope" required="yes"/>
- <xsl:param name="keydef" required="yes"/>
- <ph keyref="{$keyscope//key[ position() = last()]/text()}.role_no"/>
- <xsl:comment>#154 FIXED SUBJECT</xsl:comment>
- </xsl:template>
-
- <xsl:template mode="p5dkp:fix-topic.wymagania.title" match="ph[contains(@keyref,'map.descr')]">
- <xsl:param name="keyscope" required="yes"/>
- <xsl:param name="keydef" required="yes"/>
- <xsl:variable name="max_keyscope" select="max($keyscope//key/string-length(text()))"/>
- <xsl:variable name="max_keyscope.pos">
- <xsl:for-each select="$keyscope//key">
- <xsl:if test="string-length(text()) = $max_keyscope"><xsl:value-of select="position()"/></xsl:if>
- </xsl:for-each>
- </xsl:variable>
- <ph keyref="{$keyscope//key[ position() = $max_keyscope.pos]/text()}.wymagania_desc"/>
- <xsl:comment>#256 FIXED SUBJECT</xsl:comment>
- </xsl:template>
-
- <xsl:template mode="p5dkp:fix-topic.role.title p5dkp:fix-topic.wymagania.title" match="*">
- <xsl:copy-of select="."/>
- </xsl:template>
-
-
- <xsl:template mode="p5dkp:fix-topic.role" match="tbody[row[ not(entry[ph[contains(@keyref,'role.')] ])]]">
- <xsl:param name="keyscope" required="yes"/>
- <xsl:param name="keydef" required="yes"/>
- <xsl:message>#133 TO FIX <xsl:value-of select=".//@*"/></xsl:message>
- <xsl:comment>#133 to fix <xsl:copy-of select=".//@*"/></xsl:comment>
- <tbody>
- <row>
- <entry><ph keyref="{$keyscope//key[ position() = last()]/text()}.role_no"/></entry>
- <entry><ph keyref="{$keyscope//key[ position() = last()]/text()}.role_desc"/></entry>
- <entry><ph keyref="{$keyscope//key[ position() = last()]/text()}.role_price"/></entry>
- </row>
- </tbody>
- </xsl:template>
-
- <xsl:template mode="p5dkp:fix-topic.wymagania" match="strow[ stentry[xref[contains(@keyref,'map.role')] ]]">
- <xsl:param name="keyscope" required="yes"/>
- <xsl:param name="keydef" required="yes"/>
- <xsl:message>#1333 TO FIX <xsl:value-of select=".//@*"/></xsl:message>
-
- <strow>
- <xsl:variable name="max_keyscope" select="max($keyscope//key/string-length(text()))"/>
- <xsl:variable name="max_keyscope.pos">
- <xsl:for-each select="$keyscope//key">
- <xsl:if test="string-length(text()) = $max_keyscope"><xsl:value-of select="position()"/></xsl:if>
- </xsl:for-each>
- </xsl:variable>
- <xsl:comment>#133 to fix <xsl:copy-of select=".//@*"/> $max_keyscope = <xsl:value-of select="$max_keyscope"/> ; $max_keyscope.pos = <xsl:value-of select="$max_keyscope.pos"/> </xsl:comment>
- <stentry><xref keyref="{$keyscope//key[ $max_keyscope.pos]/text()}.role_no"/>
- <!--<ph keyref="wymagania.ogolne.harmonotram.role_no"/>--></stentry>
- <stentry>
- <ph keyref="{$keyscope//key[ $max_keyscope.pos]/text()}.role_desc"/></stentry>
- <stentry>
- <ph keyref="{$keyscope//key[ $max_keyscope.pos]/text()}.role_price"/>
- </stentry>
- <stentry>
- <ph keyref="{$keyscope//key[ $max_keyscope.pos]/text()}.role_time"/>
- </stentry>
- <stentry>
- <ph keyref="{$keyscope//key[ $max_keyscope.pos]/text()}.role_price_recur"/>
- </stentry>
- <stentry>
- <ph keyref="{$keyscope//key[$max_keyscope.pos]/text()}.etap_no"/>
- </stentry>
- </strow>
- </xsl:template>
-
- <xsl:template mode="p5dkp:fix-topic" match="*|comment()|text()"/>
-
-
-
- </xsl:stylesheet>
|