| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378 |
- <?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:p5xsda="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/xsd_asserts/p5xsda.xsd"
- xmlns:ditaarch="http://dita.oasis-open.org/architecture/2005/"
- xmlns:system_cache__dita="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/dita.xsd"
- xmlns:p5dg="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/documentation_generator/documentation_generator.xsd"
- exclude-result-prefixes="xs ditaarch"
- version="2.0">
-
- <xsl:include href="../documentation_generator/p5dg.filepath.xsl"/>
- <xsl:include href="p5dkp.ditafiles.func.isditafile.xsl"/>
-
- <xsl:output indent="yes" method="xml" exclude-result-prefixes="ditaarch"/>
- <!--<xsl:output indent="yes" method="xml" standalone="no" doctype-public="-//OASIS//DTD DITA Glossary Group//EN" doctype-system="glossgroup.dtd"/>-->
- <xsl:strip-space elements="*"/>
-
-
- <xsl:param name="ditafiles.func.merge_path.map.path1" select="'/Users/a.binder/procesy5-dita-templates-druki/7007.Dostarczenie_systemu_Myjni_Inteligentnej/klient.workers/'"/><!-- target -->
- <xsl:param name="ditafiles.func.merge_path.href1" select="'rafa__rogoz.ditamap'"/>
- <xsl:param name="ditafiles.func.merge_path.map.path2" select="'/Users/a.binder/procesy5-dita-templates-druki'"/><!-- source -->
- <xsl:param name="ditafiles.func.merge_path.href2" select="'7007.Dostarczenie_systemu_Myjni_Inteligentnej/projekt_7007_dostarczenie_systemu_aplikacji_mobilnej_dla_myjni.ditamap'"/>
-
- <xsl:template name="p5dkp:ditafiles.func.merge_path">
- <p5dkp:ditafiles.func.merge_path>
- <xsl:copy-of select="p5dkp:ditafiles.func.merge_path($ditafiles.func.merge_path.map.path1,$ditafiles.func.merge_path.href1,$ditafiles.func.merge_path.map.path2,$ditafiles.func.merge_path.href2)"/>
- </p5dkp:ditafiles.func.merge_path>
- </xsl:template>
-
-
-
-
- <xsl:function name="p5dkp:ditafiles.func.isditamapfile">
- <xsl:param name="href"/>
- <xsl:choose>
- <xsl:when test="contains($href,'.ditamap')">
- <xsl:value-of select="true()"/>
- </xsl:when>
- </xsl:choose>
- </xsl:function>
-
-
- <xsl:function name="p5dkp:ditafiles.file_from_fullpath.rel">
- <xsl:param name="fullpath"/>
- <xsl:variable name="out">
- <xsl:for-each select="tokenize($fullpath,'/')">
- <xsl:choose>
- <xsl:when test="position() = 1">
- <xsl:value-of select="concat(.,'/')"/>
- </xsl:when>
- <xsl:when test="position() = last()">
- <xsl:value-of select="concat(.,'/')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat(.,'/')"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:variable>
- <xsl:value-of select="p5dg:filepath.clean($out)"/>
- </xsl:function>
-
- <xsl:function name="p5dkp:ditafiles.file_from_fullpath">
- <xsl:param name="fullpath"/>
- <xsl:variable name="path_len" select="count(tokenize($fullpath,'/'))"/>
- <xsl:variable name="out">
- <xsl:choose>
- <xsl:when test="$path_len > 0">
- <xsl:for-each select="tokenize($fullpath,'/')">
- <xsl:choose>
- <xsl:when test="position() = last()">
- <xsl:value-of select="."/>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$fullpath"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:value-of select="$out"/>
- </xsl:function>
-
-
- <xsl:function name="p5dkp:ditafiles.dir_from_fullpath">
- <xsl:param name="fullpath"/>
- <!--<xsl:message>#98 <xsl:value-of select="$fullpath"/></xsl:message>-->
- <xsl:variable name="path_len" select="count(tokenize($fullpath,'/'))"/>
- <xsl:variable name="out">
- <xsl:choose>
- <xsl:when test="$path_len > 0">
- <xsl:for-each select="tokenize($fullpath,'/')">
- <xsl:choose>
- <xsl:when test="position() = 1">
- <xsl:value-of select="concat(.,'/')"/>
- </xsl:when>
- <xsl:when test="position() < $path_len and not(position() = last())">
- <xsl:value-of select="concat(.,'/')"/>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </xsl:when>
- </xsl:choose>
- </xsl:variable>
- <xsl:value-of select="$out"/>
- </xsl:function>
-
- <xsl:function name="p5dkp:ditafiles.func.merge_path.string.file">
- <xsl:param name="map.path1"/>
- <xsl:param name="href1"/>
- <xsl:param name="map.path2"/>
- <xsl:param name="href2"/>
- <xsl:value-of select="concat(p5dkp:ditafiles.func.merge_path.string($map.path1,$href1,$map.path2,$href2),'/',$href1)"/>
- </xsl:function>
-
- <xsl:function name="p5dkp:ditafiles.func.merge_path.string">
- <xsl:param name="map.path1"/>
- <xsl:param name="href1"/>
- <xsl:param name="map.path2"/>
- <xsl:param name="href2"/>
- <xsl:variable name="p5dkp:ditafiles.func.merge_path">
- <p5dkp:ditafiles.func.merge_path>
- <xsl:copy-of select="p5dkp:ditafiles.func.merge_path($map.path1,$href1,$map.path2,$href2)" copy-namespaces="no"/>
- </p5dkp:ditafiles.func.merge_path>
- </xsl:variable>
- <xsl:variable name="merge_path">
- <xsl:for-each select="$p5dkp:ditafiles.func.merge_path//result/path">
- <xsl:choose>
- <xsl:when test="position() = last() and string-length(@path) > 0">
- <xsl:value-of select="@path"/>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="concat(@path,'/')"/></xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:variable>
- <xsl:value-of select="$merge_path"/>
- </xsl:function>
-
- <xsl:function name="p5dkp:ditafiles.func.merge_path.string">
- <xsl:param name="map.path1"/>
- <xsl:param name="map.path2"/>
- <xsl:variable name="p5dkp:ditafiles.func.merge_path">
- <p5dkp:ditafiles.func.merge_path>
- <xsl:copy-of select="p5dkp:ditafiles.func.merge_path($map.path1,'/FAKEFILE1.FAKE',$map.path2,'/FAKEFILE2.FAKE')" copy-namespaces="no"/>
- </p5dkp:ditafiles.func.merge_path>
- </xsl:variable>
- <xsl:variable name="merge_path">
- <xsl:for-each select="$p5dkp:ditafiles.func.merge_path//result/path">
- <xsl:choose>
- <xsl:when test="position() = last()">
- <xsl:value-of select="@path"/>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="concat(@path,'/')"/></xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:variable>
- <xsl:value-of select="$merge_path"/>
- </xsl:function>
-
- <xsl:function name="p5dkp:ditafiles.func.merge_path">
- <xsl:param name="map.path2"/>
- <xsl:param name="href2"/>
- <xsl:param name="map.path1"/>
- <xsl:param name="href1"/>
- <xsl:variable name="map1" select="p5dg:filepath.clean(concat($map.path1,'/',$href1))"/>
- <xsl:variable name="map2" select="p5dg:filepath.clean(concat($map.path2,'/',$href2))"/>
- <xsl:message>[EEE]#148DDDD $map.path1 = "<xsl:value-of select="$map.path1"/>" ; "<xsl:value-of select="$href1"/>" $map.path2 = "<xsl:value-of select="$map.path2"/>" ; "<xsl:value-of select="$href2"/>" , count(<xsl:value-of select="count($map.path2)"/>); (<xsl:value-of select="count($href2)"/>)</xsl:message>
- <xsl:message>[EEE]#148DDDD-B $map1=<xsl:value-of select="$map1"/>; $map2=<xsl:value-of select="$map2"/>;</xsl:message>
- <xsl:variable name="p5dkp:ditafiles.func.merge_path">
- <p5dkp:ditafiles.func.merge_path>
- <xsl:variable name="map2.len" select="count(tokenize($map2,'/'))"/>
- <xsl:attribute name="p5dg:filepath.clean.1" select="$map1"/>
- <xsl:attribute name="p5dg:filepath.clean.2" select="$map2"/>
- <xsl:attribute name="map.path1" select="$map.path1"/>
- <xsl:attribute name="href1" select="$href1"/>
- <xsl:attribute name="map.path2" select="$map.path2"/>
- <xsl:attribute name="href2" select="$href2"/>
- <xsl:for-each select="tokenize($map1,'/')">
- <xsl:variable name="pos1" select="position()"/>
- <xsl:variable name="text1" select="."/>
- <xsl:choose>
- <xsl:when test="position() > $map2.len">
- <path1 pos="{xs:integer($pos1)}">
- <xsl:attribute name="mismatch" select="."/>
- </path1>
- </xsl:when>
- <xsl:otherwise>
- <path1 pos="{xs:integer($pos1)}">
- <!--<xsl:message>#148 $map.path1 = "<xsl:value-of select="$map.path1"/>" ; "<xsl:value-of select="$href1"/>" $map.path2 = "<xsl:value-of select="$map.path2"/>" ; "<xsl:value-of select="$href2"/>" , count(<xsl:value-of select="count($map.path2)"/>); (<xsl:value-of select="count($href2)"/>)</xsl:message>-->
- <xsl:for-each select="tokenize($map2,'/')">
- <xsl:choose>
- <xsl:when test="position() = $pos1">
- <xsl:choose>
- <xsl:when test=". = $text1">
- <xsl:attribute name="same" select="$text1"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="mismatch" select="$text1"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
- </xsl:for-each>
- </path1>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </p5dkp:ditafiles.func.merge_path>
- </xsl:variable>
- <xsl:variable name="p5dkp:ditafiles.func.merge_path2">
- <p5dkp:ditafiles.func.merge_path2>
- <xsl:variable name="map1.len" select="count(tokenize($map1,'/'))"/>
- <xsl:for-each select="tokenize($map2,'/')">
- <xsl:variable name="pos2" select="position()"/>
- <xsl:variable name="text2" select="."/>
- <xsl:choose>
- <xsl:when test="position() > $map1.len">
- <path2 pos="{xs:integer($pos2)}">
- <xsl:attribute name="mismatch" select="."/>
- </path2>
- </xsl:when>
- <xsl:otherwise>
- <path2 pos="{xs:integer($pos2)}">
- <xsl:for-each select="tokenize($map1,'/')">
- <xsl:choose>
- <xsl:when test="position() = $pos2">
- <xsl:choose>
- <xsl:when test=". = $text2">
- <xsl:attribute name="same" select="$text2"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="mismatch" select="$text2"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
-
- </xsl:for-each>
- </path2>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
-
- </p5dkp:ditafiles.func.merge_path2>
- </xsl:variable>
- <xsl:copy-of select="$p5dkp:ditafiles.func.merge_path" copy-namespaces="no"/>
- <xsl:copy-of select="$p5dkp:ditafiles.func.merge_path2" copy-namespaces="no"/>
- <xsl:variable name="min.mismatch" > <!-- select="min($p5dkp:ditafiles.func.merge_path//path1[@mismatch]/number(@pos)) cast as xs:integer " -->
- <xsl:choose>
- <xsl:when test="$p5dkp:ditafiles.func.merge_path//path1[@mismatch]/@pos">
- <xsl:value-of select="min($p5dkp:ditafiles.func.merge_path//path1[@mismatch]/number(@pos)) cast as xs:integer "/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="0"/>
- <xsl:message terminate="no">###273 same path?! situation path1= <xsl:copy-of select="$p5dkp:ditafiles.func.merge_path//path1"></xsl:copy-of></xsl:message>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="max.mismatch" >
- <xsl:choose>
- <xsl:when test="not($p5dkp:ditafiles.func.merge_path//path1[@mismatch]/@pos)">
- <xsl:value-of select="0"/>
- <xsl:message>#282 same path?! WARNING </xsl:message>
- </xsl:when>
- <!--<xsl:when test="max(($p5dkp:ditafiles.func.merge_path//path1[@mismatch]/number(@pos)) ) cast as xs:integer > max($p5dkp:ditafiles.func.merge_path2//path2[@mismatch]/number(@pos)) cast as xs:integer ">
- <xsl:value-of select="max(($p5dkp:ditafiles.func.merge_path//path1[@mismatch]/number(@pos)) ) cast as xs:integer "/>
- </xsl:when>-->
- <xsl:otherwise >
- <xsl:value-of select="max(($p5dkp:ditafiles.func.merge_path//path1[@mismatch]/number(@pos)) ) cast as xs:integer "/>
- </xsl:otherwise>
- <!--<xsl:otherwise>
- <xsl:value-of select="max($p5dkp:ditafiles.func.merge_path2//path2[@mismatch]/number(@pos)) cast as xs:integer "/>
- </xsl:otherwise>-->
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="max.mismatch.2" >
- <xsl:choose>
- <xsl:when test="not($p5dkp:ditafiles.func.merge_path2//path2[@mismatch]/@pos)">
- <xsl:value-of select="0"/>
- <xsl:message>#282 same path?! WARNING </xsl:message>
- </xsl:when>
- <!--<xsl:when test="max(($p5dkp:ditafiles.func.merge_path//path1[@mismatch]/number(@pos)) ) cast as xs:integer > max($p5dkp:ditafiles.func.merge_path2//path2[@mismatch]/number(@pos)) cast as xs:integer ">
- <xsl:value-of select="max(($p5dkp:ditafiles.func.merge_path//path1[@mismatch]/number(@pos)) ) cast as xs:integer "/>
- </xsl:when>-->
- <xsl:otherwise >
- <xsl:value-of select="max(($p5dkp:ditafiles.func.merge_path2//path2[@mismatch]/number(@pos)) ) cast as xs:integer "/>
- </xsl:otherwise>
- <!--<xsl:otherwise>
- <xsl:value-of select="max($p5dkp:ditafiles.func.merge_path2//path2[@mismatch]/number(@pos)) cast as xs:integer "/>
- </xsl:otherwise>-->
- </xsl:choose>
- </xsl:variable>
-
- <xsl:variable name="map.path1.len">
- <xsl:choose>
- <xsl:when test="count(tokenize($map1,'/')) > 0 " >
- <xsl:value-of select="count(tokenize($map1,'/')) cast as xs:string"/>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="0"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="map.path2.len">
- <xsl:choose>
- <xsl:when test="count(tokenize($map2,'/')) > 0 " >
- <xsl:value-of select="count(tokenize($map2,'/')) cast as xs:string"/>
- </xsl:when>
- <xsl:otherwise><xsl:value-of select="0"/></xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="max.path.len" >
- <xsl:for-each select="($map.path1.len,$map.path2.len)">
- <xsl:sort select="." order="descending" data-type="number"/>
- <xsl:if test="position() = 1"><xsl:value-of select=". cast as xs:integer"/></xsl:if>
- </xsl:for-each>
- </xsl:variable>
- <result>
- <xsl:attribute name="min.mismatch" select="$min.mismatch" />
- <xsl:attribute name="max.mismatch" select="$max.mismatch" />
- <xsl:attribute name="max.mismatch.2" select="$max.mismatch.2" />
- <xsl:attribute name="map.path1.len" select="$map.path1.len"/>
- <xsl:attribute name="map.path2.len" select="$map.path2.len"/>
- <xsl:attribute name="max.path.len" select="$max.path.len"/>
- <!--<xsl:message>#max.path.len = <xsl:value-of select="$max.path.len"/> ; $map.path1.len = <xsl:value-of select="$map.path1.len"/>; $map.path2.len = <xsl:value-of select="$map.path2.len"/>; </xsl:message>-->
- <xsl:variable name="source.file.tune">
- <xsl:choose>
- <xsl:when test="string-length($href1) > 0">
- <xsl:value-of select="1"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="1"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:for-each select="$min.mismatch to ( xs:integer($max.mismatch ) - xs:integer($source.file.tune))"> <!-- - 1 -->
- <path>
- <xsl:attribute name="pos" select="position()"/>
- <xsl:attribute name="path" select="'..'"/>
- <xsl:attribute name="ind" select="."/>
- </path>
- </xsl:for-each>
-
- <xsl:for-each select="$min.mismatch to ( xs:integer($max.mismatch.2 ))">
- <xsl:choose>
- <xsl:when test="$p5dkp:ditafiles.func.merge_path2//path2[ matches(concat('III',@pos,'III'),xs:string(concat('III',current(),'III'))) ]/@mismatch">
- <path>
- <xsl:attribute name="pos" select="position()"/>
- <xsl:attribute name="path" select="$p5dkp:ditafiles.func.merge_path2//path2[ matches(concat('III',@pos,'III'),xs:string(concat('III',current(),'III'))) ]/@mismatch" />
- <xsl:attribute name="ind" select="."/>
- <!--<xsl:attribute name="path22" select="$p5dkp:ditafiles.func.merge_path2//path2[@pos=$min.mismatch.pos]/@mismatch"/>
- <xsl:attribute name="path22" select="$p5dkp:ditafiles.func.merge_path2//path2[@pos=$min.mismatch.pos]/@mismatch"/>-->
- </path>
- </xsl:when>
- <xsl:otherwise>
- <else>
- <xsl:attribute name="pos" select="position()"/>
- <xsl:attribute name="path" select="$p5dkp:ditafiles.func.merge_path2//path2[ @pos = current() ]/@mismatch" />
- <xsl:attribute name="ind" select="."/>
- </else>
- </xsl:otherwise>
- </xsl:choose>
-
- </xsl:for-each>
- <!--<xsl:for-each select="$p5dkp:ditafiles.func.merge_path//path[number(@pos) < $min.mismatch]">
-
- </xsl:for-each>-->
- </result>
- </xsl:function>
-
-
- </xsl:stylesheet>
|