| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389 |
- <?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 xsi ditaarch"
- version="2.0"> <!-- xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/" -->
-
- <xsl:import href="p5dkp.fix-topic.xsl"/>
- <xsl:import href="p5dkp.fix-ditamap.xsl"/>
- <xsl:output indent="yes" method="xml" standalone="no" doctype-public="-//OASIS//DTD DITA Glossary Group//EN" doctype-system="glossgroup.dtd"/>
- <!--<xsl:output indent="yes" />-->
- <xsl:strip-space elements="*"/>
-
- <!--<xsl:variable name="debug" select="99"/>-->
- <xsl:param name="p5dkp:fix-glossgroup.force" select="true()"/> <!-- to force refresh of all contents by keys -->
- <xsl:param name="p5dkp:fix-glossgroup.fix.prefix" select="'fixedgg'"/>
-
- <xsl:template name="p5dkp:fix-glossgroup">
- <xsl:param name="file.href" required="yes"/>
- <xsl:param name="map.path" required="yes"/>
- <xsl:param name="keyscope" required="yes"/>
- <xsl:param name="keyscope.attr" required="yes"/>
- <xsl:param name="keydef" required="yes"/>
- <xsl:param name="href" required="yes"/>
- <xsl:apply-templates mode="p5dkp:fix-glossgroup" select="doc($file.href)"> <!-- doc(concat($path,'/',@href)) -->
- <xsl:with-param name="map.path" select="$map.path"/>
- <xsl:with-param name="keyscope" select="$keyscope"/>
- <xsl:with-param name="keyscope.attr" select="$keyscope.attr"/>
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="href" select="$href"/>
- </xsl:apply-templates>
- </xsl:template>
-
-
- <xsl:template mode="p5dkp:fix-glossgroup" match="glossgroup">
- <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-glossgroup>
- <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()))"/>
- <xsl:if test="number($debug) > 2"><xsl:message>#6666 $max_keyscope=<xsl:value-of select="$max_keyscope"/>; p5dkp:max_keyscope.pos($keyscope)=<xsl:value-of select="p5dkp:max_keyscope.pos($keyscope)"/>; p5dkp:max_keyscope.get($keyscope,p5dkp:max_keyscope.pos($keyscope))=<xsl:value-of select="p5dkp:max_keyscope.get($keyscope,p5dkp:max_keyscope.pos($keyscope))"/></xsl:message></xsl:if>
- <!--<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:message>#59 ignoring glossgroup fix for current() = 'role'</xsl:message>
- <!--<xsl:variable name="p5dkp:fix-glossgroup.role">
- <xsl:apply-templates mode="p5dkp:fix-glossgroup.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-glossgroup.role//comment()">
- <p5suis:say> Fixed dita to copy <xsl:value-of select="$href"/></p5suis:say>
- <xsl:message>#68 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-glossgroup.role"/>
- </xsl:result-document>-\->
- </xsl:when>
- </xsl:choose>-->
- </xsl:when>
- <xsl:when test="current() = 'wymagania'">
-
- <xsl:variable name="p5dkp:fix-glossgroup.wymagania">
- <xsl:apply-templates mode="p5dkp:fix-glossgroup.wymagania" select="$context" xpath-default-namespace="">
- <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-glossgroup.wymagania"/>
- </TEST>
- <CONTEXT>
- <xsl:copy-of select="$context"/>
- </CONTEXT>
- </TRY_WYMAGANIA>-->
- <xsl:choose>
- <xsl:when test="$p5dkp:fix-glossgroup.wymagania//comment()">
- <p5dkp:fix-glossgroup.wymagania.dstfile srcfile="{$map.path}/{$href}" dstfile="{$map.path}/{$href}.{$p5dkp:fix-glossgroup.fix.prefix}"/>
- <p5suis:say> Fixed glossgroup dita to copy <xsl:value-of select="$href"/></p5suis:say>
- <xsl:message>#822 Fixed glossgroup 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,'.',$p5dkp:fix-glossgroup.fix.prefix))">
- <xsl:message>#123 DOCUMENT EXISTS - should bbefore go clean! <xsl:value-of select="$href"/>.<xsl:value-of select="$p5dkp:fix-glossgroup.fix.prefix"/> !</xsl:message>
- <xsl:message>#124 count of previous hits of $href <!--<xsl:value-of select="document-uri(current())"/>-->
- <xsl:copy-of select="$keyscope" copy-namespaces="no"/>
- </xsl:message>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message>#129 echo keyscope nizej</xsl:message>
- <xsl:copy-of select="$keyscope" copy-namespaces="no"/>
- <xsl:result-document href="{$map.path}/{$href}.{$p5dkp:fix-glossgroup.fix.prefix}" ><!-- doctype-public="-//OASIS//DTD DITA Glossary Group//EN" doctype-system="glossgroup.dtd" -->
- <xsl:copy-of select="$p5dkp:fix-glossgroup.wymagania"/>
- </xsl:result-document>
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:when>
- </xsl:choose>
- <xsl:apply-templates mode="p5dkp:fix-ditamap.wymagania" select="$context" xpath-default-namespace="">
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="keyscope" select="$keyscope"/>
- <xsl:with-param name="map.path" select="$map.path"/>
- <xsl:with-param name="href" select="$href"/>
- </xsl:apply-templates>
- </xsl:when>
-
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </p5dkp:fix-glossgroup>
- </xsl:template>
-
-
-
- <xsl:template mode="p5dkp:fix-glossgroup.wymagania" match="*|text()|comment()">
- <xsl:message>#319 - something goes wrong match p5dkp:fix-glossgroup.wymagania = <xsl:copy-of select="." copy-namespaces="no"/></xsl:message>
- </xsl:template>
-
- <xsl:function name="p5dkp:menucascade">
- <xsl:param name="keyscope"/>
- <xsl:param name="keydef.keys"/>
- <sub>
- <menucascade>
- <xsl:for-each select="tokenize($keyscope,'\.')">
- <uicontrol><xsl:value-of select="."/></uicontrol>
- </xsl:for-each>
- <uicontrol><xsl:value-of select="$keydef.keys"/></uicontrol>
- </menucascade>
- </sub>
- </xsl:function>
-
- <xsl:template mode="p5dkp:fix-glossgroup.wymagania" match="glossgroup" xpath-default-namespace="" exclude-result-prefixes="ditaarch">
- <xsl:param name="keyscope" required="yes"/>
- <xsl:param name="keydef" required="yes"/>
- <xsl:message>#321 TO FIX TEST for $keyscope=<xsl:value-of select="$keyscope"/>; p5dkp:max_keyscope.get($keyscope,p5dkp:max_keyscope.pos($keyscope))=<xsl:value-of select="p5dkp:max_keyscope.get($keyscope,p5dkp:max_keyscope.pos($keyscope))"/> <xsl:value-of select=".//@*"/> </xsl:message>
- <xsl:variable name="context" select="." />
- <xsl:copy copy-namespaces="no">
- <xsl:for-each select="$keydef">
- <xsl:variable name="keydef.keys" select="@keys"/>
- <xsl:choose>
- <xsl:when test="$context/.//*[@keyref = concat($keyscope,'.',$keydef.keys)] and position() = 1 and not($p5dkp:fix-glossgroup.force)" >
- <xsl:message>#347-AAB-A OK is set $context/.//*[@keyref $keydef.keys]] $$keydef.keys = <xsl:value-of select="$keydef.keys"/> </xsl:message>
- <xsl:copy-of select="$context/@*"/>
- <xsl:copy-of select="$context/title"/>
- <!--<FIRST_STAGE>-->
- <xsl:apply-templates mode="p5dkp:fix-glossgroup.wymagania.child" xpath-default-namespace="">
- <xsl:with-param name="keyscope" select="$keyscope"/>
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="context" select="$context"/>
- <!--<xsl:with-param name="force.glossgroup" select="true()"/>-->
- </xsl:apply-templates>
- <!--</FIRST_STAGE>-->
- </xsl:when>
- <xsl:when test="position() = 1">
- <xsl:message>#17555 position = 1 else - adding <xsl:value-of select="$keydef.keys"/> </xsl:message>
- <xsl:attribute name="id" select="$keydef.keys"/>
- <xsl:comment>179 ADDED COS</xsl:comment>
- <!--<SECOND>-->
- <title>
- <ph keyref="{p5dkp:max_keyscope.get($keyscope,p5dkp:max_keyscope.pos($keyscope))}.{$keydef.keys}"/>
- <!--<sub>Sciezka wymagan: <xsl:value-of select="p5dkp:max_keyscope.get($keyscope,p5dkp:max_keyscope.pos($keyscope))"/> .<xsl:value-of select="$keydef.keys"/></sub>-->
- <xsl:copy-of select="p5dkp:menucascade(p5dkp:max_keyscope.get($keyscope,p5dkp:max_keyscope.pos($keyscope)),$keydef.keys)"></xsl:copy-of>
- </title>
- <xsl:apply-templates mode="p5dkp:fix-glossgroup.wymagania.child" xpath-default-namespace="">
- <xsl:with-param name="keyscope" select="$keyscope"/>
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="context" select="$context"/>
- <!--<xsl:with-param name="force.glossgroup" select="true()"/>-->
- </xsl:apply-templates>
- <!--</SECOND>-->
- </xsl:when>
- <xsl:when test="position() = 2">
- <!--<THIRD>-->
- <!-- <glossgroup
- id="{$keydef.keys}">
- <title>
- <ph keyref="{p5dkp:max_keyscope.get($keyscope,p5dkp:max_keyscope.pos($keyscope))}.{$keydef.keys}"/>
- Ścieżka wymagań<codeph><xsl:value-of select="p5dkp:max_keyscope.get($keyscope,p5dkp:max_keyscope.pos($keyscope))"/>.<xsl:value-of select="$keydef.keys"/></codeph>
- </title>
- <xsl:apply-templates mode="p5dkp:fix-glossgroup.wymagania.child" xpath-default-namespace="">
- <xsl:with-param name="keyscope" select="$keyscope"/>
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="context" select="$context"/>
- </xsl:apply-templates>
- -->
- <xsl:for-each select="$keydef">
- <xsl:choose>
- <xsl:when test="position() > 1">
- <xsl:apply-templates mode="p5dkp:fix-glossgroup.wymagania.child" select="." xpath-default-namespace="">
- <xsl:with-param name="keyscope" select="$keyscope"/>
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="context" select="$context"/>
- </xsl:apply-templates>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- <!--</THIRD>-->
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </xsl:copy>
- </xsl:template>
-
-
- <xsl:template mode="p5dkp:fix-glossgroup.wymagania.child" match="*" xpath-default-namespace="">
- <xsl:param name="keyscope" required="yes"/>
- <xsl:param name="keydef" required="yes"/>
- <xsl:param name="context" required="yes"/>
- <!--<xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>-->
- <xsl:apply-templates mode="p5dkp:fix-glossgroup.wymagania.child" xpath-default-namespace="">
- <xsl:with-param name="keyscope" select="$keyscope"/>
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="context" select="$context"/>
- </xsl:apply-templates>
- <!--</xsl:copy>-->
- </xsl:template>
-
-
-
- <xsl:template mode="p5dkp:fix-glossgroup.wymagania.child.copy" match="*">
- <xsl:copy copy-namespaces="no">
- <xsl:copy-of select="@*"/>
- <xsl:apply-templates mode="p5dkp:fix-glossgroup.wymagania.child.copy"/>
- </xsl:copy>
- </xsl:template>
-
- <xsl:template mode="p5dkp:fix-glossgroup.wymagania.child.copy" match="text()">
- <xsl:copy-of select="."/>
- </xsl:template>
-
-
- <xsl:template mode="p5dkp:fix-glossgroup.wymagania.child.copy" match="keydef"/>
-
-
-
-
-
- <xsl:template mode="p5dkp:fix-glossgroup.wymagania.child" match="text()|comment()" xpath-default-namespace=""/>
-
- <xsl:template mode="p5dkp:fix-glossgroup.wymagania.child" match="* [ local-name()='keydef'] " xpath-default-namespace="" exclude-result-prefixes="ditaarch">
- <xsl:param name="keyscope" required="yes"/>
- <xsl:param name="keydef" required="yes"/>
- <xsl:param name="context" required="yes"/>
- <xsl:param name="force.glossgroup"/>
- <xsl:variable name="keydef.keys" select="@keys"/>
-
- <xsl:choose>
- <xsl:when test="$context/.//*[@keyref = concat($keyscope,'.',$keydef.keys)] and not($p5dkp:fix-glossgroup.force)">
- <xsl:message>#347-B-AA OK is set $context/.//*[@keyref $keydef.keys]] for $$keydef.keys = <xsl:value-of select="$keydef.keys"/></xsl:message>
- <xsl:apply-templates mode="p5dkp:fix-glossgroup.wymagania.child" xpath-default-namespace="">
- <xsl:with-param name="keyscope" select="$keyscope"/>
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="context" select="$context"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="keydef or $force.glossgroup" xpath-default-namespace="">
- <xsl:message>#195-B adding child glossgroup for <xsl:value-of select="$keydef.keys"/>;</xsl:message>
- <glossgroup
- id="{$keydef.keys}">
- <title>
- <ph keyref="{p5dkp:max_keyscope.get($keyscope,p5dkp:max_keyscope.pos($keyscope))}.{$keydef.keys}"
- class="- topic/ph "/>
- <!--<xsl:copy-of select="p5dkp:menucascade(p5dkp:max_keyscope.get($keyscope,p5dkp:max_keyscope.pos($keyscope)),$keydef.keys)"></xsl:copy-of>-->
- </title>
- <xsl:comment>#308 fixed </xsl:comment>
- <xsl:apply-templates mode="p5dkp:fix-glossgroup.wymagania.child" xpath-default-namespace="">
- <xsl:with-param name="keyscope" select="$keyscope"/>
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="context" select="$context"/>
- </xsl:apply-templates>
- </glossgroup>
- </xsl:when>
- <xsl:otherwise>
- <glossentry id="{$keydef.keys}">
- <glossterm>Parametr: <b><xsl:value-of select="$keydef.keys"/></b></glossterm>
- <glossdef>
- <p><xsl:copy-of select="p5dkp:menucascade(p5dkp:max_keyscope.get($keyscope,p5dkp:max_keyscope.pos($keyscope)),$keydef.keys)" copy-namespaces="no"/></p>
- <p>
- <ph keyref="{p5dkp:max_keyscope.get($keyscope,p5dkp:max_keyscope.pos($keyscope))}.{$keydef.keys}"/>
- </p>
- <xsl:comment> #392-B Wymagania uzupełnione automatycznie</xsl:comment>
- <xsl:apply-templates mode="p5dkp:fix-glossgroup.wymagania.child.glosdef_content" select="$context/.//glossentry[@id=$keydef.keys]/glossdef">
- <xsl:with-param name="keyref.expected" select="concat(p5dkp:max_keyscope.get($keyscope,p5dkp:max_keyscope.pos($keyscope)),'.',$keydef.keys)"/>
- </xsl:apply-templates>
- <xsl:comment> #392-B Wymagania uzupełnione automatycznie EOF</xsl:comment>
- <xsl:if test="topicmeta/keywords/keyword/glossdef/*"><xsl:comment>#327 copying </xsl:comment></xsl:if>
- <xsl:apply-templates mode="p5dkp:fix-glossgroup.wymagania.child.copy" select="topicmeta/keywords/keyword/glossdef/*" xpath-default-namespace="">
- <xsl:with-param name="keyscope" select="$keyscope"/>
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="context" select="$context"/>
- </xsl:apply-templates>
-
- <xsl:apply-templates mode="p5dkp:fix-glossgroup.wymagania.child" xpath-default-namespace="">
- <xsl:with-param name="keyscope" select="$keyscope"/>
- <xsl:with-param name="keydef" select="$keydef"/>
- <xsl:with-param name="context" select="$context"/>
- </xsl:apply-templates>
-
- </glossdef>
- </glossentry>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
-
-
- <xsl:template mode="p5dkp:fix-glossgroup.wymagania.child.glosdef_content" match="glossdef"><!-- to retrieve existient glossdef content without -->
- <xsl:param name="keyref.expected" required="yes"/>
- <xsl:for-each select="*">
- <xsl:choose>
- <xsl:when test="sub[menucascade]"/>
- <xsl:when test="menucascade"/>
- <xsl:when test="contains(text()[1],'Ścieżka wymagań') and codeph"/>
- <xsl:when test="sub[ matches(text(),'(Sciezka.*wymagan)|(Ścieżka.*wymagań)')]"></xsl:when>
- <xsl:when test=".//@keyref=$keyref.expected"><xsl:comment>#353 $keyref.expected ignored</xsl:comment></xsl:when>
- <xsl:otherwise><xsl:comment>#352 preserved content</xsl:comment><xsl:copy-of select="." copy-namespaces="no"/></xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:template>
-
-
-
-
- <xsl:template mode="p5dkp:fix-glossgroup" match="*">
- <xsl:message>#396 uncorrect p5dkp:fix-glossgroup" match="*" = <xsl:value-of select="name()"/>; <xsl:copy-of select="@*" copy-namespaces="no"/></xsl:message>
- </xsl:template>
-
- <xsl:template mode="p5dkp:fix-glossgroup" match="comment()|text()"/>
-
- <xsl:template mode="p5dkp:fix-glossgroup.wymagania.srcfile" match="p5dkp:map.keys.xml">
- <xsl:apply-templates select=".//p5dkp:fix-glossgroup.wymagania.dstfile" mode="#current"/>
- </xsl:template>
-
- <xsl:template mode="p5dkp:fix-glossgroup.wymagania.srcfile" match="p5dkp:fix-glossgroup.wymagania.dstfile">
- <p5dkp:fix-glossgroup.wymagania.srcfile>
- <xsl:message>#363 found from @dstfile=<xsl:value-of select="@dstfile"/> to @srcfile=<xsl:value-of select="@dstfile"/>;</xsl:message>
- </p5dkp:fix-glossgroup.wymagania.srcfile>
- </xsl:template>
-
-
- </xsl:stylesheet>
|