| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200 |
- <?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:ogc="http://www.opengis.net/ogc"
- xmlns:system_cache__appinfo="http://biuro.biall-net.pl/xmlschema_procesy5/default_db_xml_cache/appinfo.xsd"
- exclude-result-prefixes="xs"
- version="2.0">
-
- <xsl:import href="../escaped_html_to_xml.xsl"/>
- <xsl:param name="ogc:debug"/>
-
- <xsl:variable name="ogc:pattern.debug" select="'((^(?!(BN)|(ND)).+$)|(.+(?<!(BN)|(ND))$))'"/> <!-- ((^(?!(BN)|(ND)).+$)|(.+(?<!(BN)|(ND))$)) -->
-
-
- <xsl:function name="ogc:translate_pattern_to_string">
- <xsl:param name="ogc:pattern"/> <!-- to convert ? ^ and ! signs to chars -->
- <xsl:variable name="EXC" select="'!'"/>
- <xsl:value-of select=" replace( replace(replace( replace( replace( replace( replace(replace(replace($ogc:pattern,'<','_LT_'),'\(','<_BRA_>'),'\)','</_BRA_>') ,'\?','_QM_' ),'\^','_EXP_' ),'\$','_DOL_' ),'\+','_PLUS_'), '!','_EXC_' ),'\|','_PIP_' ) "/>
- </xsl:function>
-
-
- <xsl:template name="ogc:main">
- <!-- debug -->
- <ogc:main>
- <xsl:message>#15 testing for $ogc:pattern=<xsl:value-of select="$ogc:pattern.debug"/>;</xsl:message>
-
- <xsl:variable name="ogc:pattern.escaped" select="ogc:translate_pattern_to_string($ogc:pattern.debug)"/>
-
- <xsl:variable name="system_cache__appinfo:escaped_html_to_xml" select="system_cache__appinfo:escaped_html_to_xml($ogc:pattern.escaped)"/>
-
- <system_cache__appinfo:escaped_html_to_xml>
- <xsl:copy-of select="$system_cache__appinfo:escaped_html_to_xml"></xsl:copy-of>
- </system_cache__appinfo:escaped_html_to_xml>
-
- <xsl:apply-templates select="$system_cache__appinfo:escaped_html_to_xml" mode="ogc:translate_pattern_to_string">
- <xsl:with-param name="name" select="'I_OPER'"/>
- </xsl:apply-templates>
-
- </ogc:main>
- </xsl:template>
-
-
- <xsl:template mode="ogc:translate_pattern_to_string" match="pattern" xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
- <xsl:param name="name" required="yes"/>
- <xsl:variable name="system_cache__appinfo:escaped_html_to_xml" select="system_cache__appinfo:escaped_html_to_xml(ogc:translate_pattern_to_string(@value))"/>
- <xsl:if test="number($ogc:debug) > 3"><xsl:message>#45 ogc:translate_pattern_to_string matched pattern count($system_cache__appinfo:escaped_html_to_xml(<xsl:value-of select="count($system_cache__appinfo:escaped_html_to_xml//*)"/>)) at @id=<xsl:value-of select="@id"/>; @value=<xsl:value-of select="@value"/>; </xsl:message></xsl:if>
- <xsl:apply-templates mode="ogc:translate_pattern_to_string" select="$system_cache__appinfo:escaped_html_to_xml">
- <xsl:with-param name="name" select="$name"/>
- </xsl:apply-templates>
- <!-- to create ogc filter from input like this ((^(?!(BN)|(ND)).+$)|(.+(?<!(BN)|(ND))$)) -->
-
-
- </xsl:template>
-
- <xsl:template mode="ogc:translate_pattern_to_string ogc:translate_pattern_to_string.singleNegation" match="text()"/>
-
-
-
-
-
- <xsl:template mode="ogc:translate_pattern_to_string" match="_BRA_[_BRA_ and not(text()='_QM__EXC_') and not( text()='_PIP_')]">
- <xsl:param name="name" required="yes"/>
- <xsl:if test="number($ogc:debug) > 3">
- <xsl:comment>#47 match="_BRA_[_BRA_]" text()=<xsl:value-of select="text()"/>; <xsl:for-each select="./text()">[<xsl:value-of select="position()"/>]=<xsl:value-of select="."/>; </xsl:for-each></xsl:comment>
- <xsl:message>#47 match="_BRA_[_BRA_]" text()=<xsl:value-of select="text()"/>; <xsl:for-each select="./text()">[<xsl:value-of select="position()"/>]=<xsl:value-of select="."/>; </xsl:for-each></xsl:message>
- </xsl:if>
- <xsl:apply-templates mode="ogc:translate_pattern_to_string">
- <xsl:with-param name="text" select="text()"/>
- <xsl:with-param name="name" select="$name"/>
- </xsl:apply-templates>
- </xsl:template>
-
-
- <xsl:template mode="ogc:translate_pattern_to_string" match="_BRA_[ text()='_PIP_' and _BRA_/text()='_EXP_' and _BRA_/text()='._PLUS__DOL_' and _BRA_/text()='._PLUS_' and _BRA_/text()='_DOL_' ]" priority="9"> <!-- -->
- <xsl:param name="name" required="yes"/>
- <ogc:And>
- <xsl:if test="number($ogc:debug) > 3">
- <xsl:comment>#73-A -
- wariant dla pojedynczej negacji aby nie wystepowala wartosc z enum - np I_OPER!= BN or ND
- childs _QM__EXC + _QM__LT__EXC - oznacza negacje wystapienia jednego elementu - brac jedno match="_BRA_[_BRA_ and not(text()='_QM__EXC_') and text()='_PIP_']" text()=<xsl:value-of select="text()"/>; <xsl:for-each select="./text()">[<xsl:value-of select="position()"/>]=<xsl:value-of select="."/>; </xsl:for-each></xsl:comment>
- <xsl:comment> _BRA_/text()=;<xsl:for-each select="_BRA_"> = [<xsl:value-of select="position()"/>]=<xsl:value-of select="text()"/></xsl:for-each></xsl:comment>
- <xsl:message> _BRA_/text()=;<xsl:for-each select="_BRA_"> = [<xsl:value-of select="position()"/>]=<xsl:value-of select="text()"/></xsl:for-each></xsl:message>
- </xsl:if>
- <xsl:apply-templates mode="ogc:translate_pattern_to_string.singleNegation" >
- <xsl:with-param name="text" select="text()"/>
- <xsl:with-param name="name" select="$name"/>
- </xsl:apply-templates>
- </ogc:And>
- </xsl:template>
-
- <xsl:template mode="ogc:translate_pattern_to_string" match="_BRA_[ text()='._PLUS__DOL_']">
- <xsl:param name="name" required="yes"/>
- <xsl:if test="number($ogc:debug) > 3">
- <xsl:comment>
- #84-A* Bypased element <xsl:value-of select="name()"/> ; text()=<xsl:value-of select="text()"/></xsl:comment>
- <xsl:message>
- #84-A* Bypased element <xsl:value-of select="name()"/> ; text()=<xsl:value-of select="text()"/></xsl:message>
- </xsl:if>
- <xsl:apply-templates mode="#current">
- <xsl:with-param name="name" select="$name"/>
- </xsl:apply-templates>
- </xsl:template>
-
-
- <xsl:template mode="ogc:translate_pattern_to_string.singleNegation" match="*">
- <xsl:param name="name" required="yes"/>
- <xsl:if test="number($ogc:debug) > 3">
- <xsl:comment>
- #84-B* Bypased element <xsl:value-of select="name()"/> ; text()=<xsl:value-of select="text()"/></xsl:comment>
- <xsl:message>
- #84-B* Bypased element <xsl:value-of select="name()"/> ; text()=<xsl:value-of select="text()"/></xsl:message>
- </xsl:if>
- <xsl:apply-templates mode="#current" select="_BRA_[1]">
- <xsl:with-param name="name" select="$name"/>
- </xsl:apply-templates>
- </xsl:template>
-
- <xsl:template mode="ogc:translate_pattern_to_string" match="_BRA_[_BRA_ and not(text()='_QM__EXC_') and text()='_PIP_' and not(text()='_QM__LT__EXC_')]" >
- <xsl:param name="name" required="yes"/>
- <ogc:Or>
- <xsl:if test="number($ogc:debug) > 3">
- <xsl:comment>#73 match="_BRA_[_BRA_ and not(text()='_QM__EXC_') and text()='_PIP_']" text()=<xsl:value-of select="text()"/>; <xsl:for-each select="./text()">[<xsl:value-of select="position()"/>]=<xsl:value-of select="."/>; </xsl:for-each></xsl:comment>
- <xsl:message>#73 match="_BRA_[_BRA_ and not(text()='_QM__EXC_') and text()='_PIP_']" text()=<xsl:value-of select="text()"/>; <xsl:for-each select="./text()">[<xsl:value-of select="position()"/>]=<xsl:value-of select="."/>; </xsl:for-each></xsl:message>
- <xsl:comment>
- text()=<xsl:value-of select="text()"/>
- _BRA_/text()=; <xsl:value-of select="_BRA_/text()"/> <xsl:for-each select="_BRA_/text()"> = [<xsl:value-of select="position()"/>]=<xsl:value-of select="."/></xsl:for-each></xsl:comment>
- </xsl:if>
- <xsl:apply-templates mode="ogc:translate_pattern_to_string">
- <xsl:with-param name="text" select="text()"/>
- <xsl:with-param name="name" select="$name"/>
- </xsl:apply-templates>
- </ogc:Or>
- </xsl:template>
-
- <xsl:template mode="ogc:translate_pattern_to_string" match="_BRA_[_BRA_ and text()='_QM__EXC_' and text()='_PIP']">
- <xsl:param name="name" required="yes"/>
- <ogc:Or>
- <xsl:comment>#71 match="_BRA_[_BRA_ and text()='_PIP']"</xsl:comment>
- <xsl:apply-templates mode="ogc:translate_pattern_to_string">
- <xsl:with-param name="text" select="text()"/>
- <xsl:with-param name="name" select="$name"/>
- </xsl:apply-templates>
- </ogc:Or>
- </xsl:template>
-
- <xsl:template mode="ogc:translate_pattern_to_string" match="_BRA_[ text()='_QM__EXC_' or text()='_QM__LT__EXC_']">
- <xsl:param name="name" required="yes"/>
- <xsl:param name="text"/>
- <ogc:Not>
- <xsl:if test="number($ogc:debug) > 3"><xsl:comment>#95-A match="_BRA_[ text()='_QM__EXC_' or text()='_QM__LT__EXC_']" - w zasadzie jak jest _QM__LT__EXC_ oraz _QM__EXC_ oznacza to zwykla negacje aby cos nie bylo w tekscie, wiec mozna olac na wstepie dwa dzieci i wziadc jedno
- text()=<xsl:value-of select="text()"/>;
- </xsl:comment>
- </xsl:if>
- <!--<parent_text><xsl:value-of select="$text"/> <xsl:for-each select="$text">[<xsl:value-of select="position()"/>]=<xsl:value-of select="."/>; </xsl:for-each></parent_text>-->
- <!--<current><xsl:copy-of select="*"></xsl:copy-of></current>-->
- <xsl:apply-templates mode="#current">
- <xsl:with-param name="text" select="text()"/>
- <xsl:with-param name="name" select="$name"/>
- </xsl:apply-templates>
- </ogc:Not>
- </xsl:template>
-
- <xsl:template mode="ogc:translate_pattern_to_string.singleNegation" match="_BRA_[ text()='_QM__EXC_']">
- <xsl:message>#144 bypassed for once filter</xsl:message>
- </xsl:template>
- <xsl:template mode="ogc:translate_pattern_to_string.singleNegation" match="_BRA_[ text()='_QM__LT__EXC_']">
- <xsl:param name="name" required="yes"/>
- <xsl:param name="text"/>
- <ogc:Not>
- <xsl:if test="number($ogc:debug) > 3">
- <xsl:comment>#95-B match="_BRA_[ text()='_QM__EXC_' or text()='_QM__LT__EXC_']" - w zasadzie jak jest _QM__LT__EXC_ oraz _QM__EXC_ oznacza to zwykla negacje aby cos nie bylo w tekscie, wiec mozna olac na wstepie dwa dzieci i wziadc jedno
- text()=<xsl:value-of select="text()"/>;
- </xsl:comment>
- </xsl:if>
- <!--<parent_text><xsl:value-of select="$text"/> <xsl:for-each select="$text">[<xsl:value-of select="position()"/>]=<xsl:value-of select="."/>; </xsl:for-each></parent_text>-->
- <!--<current><xsl:copy-of select="*"></xsl:copy-of></current>-->
- <xsl:apply-templates mode="#current">
- <xsl:with-param name="text" select="text()"/>
- <xsl:with-param name="name" select="$name"/>
- </xsl:apply-templates>
- </ogc:Not>
- </xsl:template>
-
-
- <xsl:template mode="ogc:translate_pattern_to_string ogc:translate_pattern_to_string.singleNegation" match="_BRA_[not(_BRA_) and text()]">
- <xsl:param name="name" required="yes"/>
- <ogc:PropertyIsEqualTo>
- <xsl:if test="number($ogc:debug) > 3">
- <xsl:comment>
- #137 matched text()=<xsl:value-of select="text()"/>;
- </xsl:comment>
- </xsl:if>
- <ogc:PropertyName><xsl:value-of select="$name"/></ogc:PropertyName>
- <ogc:Literal><xsl:value-of select="text()"/></ogc:Literal>
- </ogc:PropertyIsEqualTo>
- </xsl:template>
-
-
-
- </xsl:stylesheet>
|