| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439 |
- <?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:p5dg="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/documentation_generator/documentation_generator.xsd"
- xmlns:vc="http://www.w3.org/2007/XMLSchema-versioning"
- xmlns:SystemObjects__x3A__File="https://biuro.biall-net.pl/wfs/default_db/SystemObjects/File.xsd"
- xmlns:p5ant-interface-resp="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/ant_interface/ant_interface-resp.xsd"
- xmlns:p5ant="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache.public/ant/ant.xsd"
- xmlns:object_merge_ant_object="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/object_merge_ant_object.xsd"
- xmlns:p5dkp="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/dita_kosztorys_projektowy/p5dkp.xsd"
- exclude-result-prefixes="xs"
- version="2.0">
-
-
-
- <xsl:output indent="yes"/>
- <xsl:strip-space elements="*"/>
- <!--<xsl:import-schema schema-location="repository/p5dg.documentation.files.antstructure-resp.xsd" namespace="http://biuro.biall-net.pl/xmlschema_procesy5/WPS_Functions/ant_interface/ant_interface-resp.xsd"/>-->
-
- <xsl:function name="p5dg:filepath.clean">
- <xsl:param name="p5dg:filepath"/>
- <xsl:variable name="clean" select="replace($p5dg:filepath,'//','/')"/>
- <xsl:variable name="out">
- <xsl:for-each select="tokenize($clean,'/')">
- <xsl:choose>
- <!--<xsl:when test="position() = 1 and string-length(.) > 0">
- <xsl:value-of select="concat('/',.)"/>
- </xsl:when>-->
- <xsl:when test="position() = last() and string-length(.) = 0">
- <xsl:value-of select="."/>
- </xsl:when>
- <xsl:otherwise >
- <xsl:value-of select="concat('/',.)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:variable>
-
- <xsl:value-of select="replace($out,'//','/')"/>
- </xsl:function>
-
- <xsl:function name="p5dg:filepath.dir">
- <xsl:param name="p5dg:filepath"/>
- <xsl:variable name="out">
- <xsl:for-each select="tokenize($p5dg:filepath,'/')[ position() < count(tokenize($p5dg:filepath,'/'))]">
- <xsl:choose>
- <xsl:when test="position() = last()">
- <xsl:value-of select="."/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat(.,'/')"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:variable>
- <xsl:value-of select="$out"/>
- </xsl:function>
-
- <xsl:function name="p5dg:filepath.dir">
- <xsl:param name="p5dg:filepath"/>
- <xsl:param name="p5dg.documentation.files.index.root_dir"/>
- <xsl:value-of select="p5dg:filepath.clean(p5dg:filepath.dir.task($p5dg:filepath,$p5dg.documentation.files.index.root_dir))"/>
- </xsl:function>
-
- <xsl:function name="p5dg:filepath.dir.task">
- <xsl:param name="p5dg:filepath"/>
- <xsl:param name="p5dg.documentation.files.index.root_dir"/>
- <xsl:variable name="out">
- <xsl:value-of select="$p5dg.documentation.files.index.root_dir"/><xsl:value-of select="'/'"/>
- <xsl:for-each select="tokenize($p5dg:filepath,'/')[ position() < count(tokenize($p5dg:filepath,'/'))]">
- <xsl:choose>
- <xsl:when test="position() = last()">
- <xsl:value-of select="."/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat(.,'/')"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:variable>
- <xsl:value-of select="$out"/>
- </xsl:function>
-
- <xsl:function name="p5dg:filename">
- <xsl:param name="p5dg:filepath"/>
- <xsl:value-of select="tokenize($p5dg:filepath,'/')[ position() = count(tokenize($p5dg:filepath,'/'))]"/>
- </xsl:function>
-
- <xsl:function name="p5dg:filename.noext">
- <xsl:param name="p5dg:filepath"/>
- <xsl:variable name="out">
- <xsl:for-each select="tokenize(p5dg:filename($p5dg:filepath),'\.')">
- <xsl:choose>
- <xsl:when test="position()=1 and position()=last()">
- <xsl:value-of select="."/>
- </xsl:when>
- <xsl:when test="position()=last()"></xsl:when>
- <xsl:when test="position()=(last() -1 )">
- <xsl:value-of select="."/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="."/><xsl:text>.</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </xsl:variable>
- <xsl:copy-of select="$out"/>
- </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>
|