Changeset 22707 in main


Ignore:
Timestamp:
03/15/21 10:59:14 (7 months ago)
Author:
GarthBraithwaite_STG
Message:

view - updated docs and internal workings of ibis.include.

Location:
trunk/ibisph-view/src/main/webapp/xslt
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/ibisph-view/src/main/webapp/xslt/_ibis-format.xslt

    r22244 r22707  
    4040        <xsl:param name="ibis.defaultNumericPicture" select="',##0.##'"
    4141                ibis:doc="default number picture format.  Done as a variable so that
    42                 site specefic templates can override."
     42                        site specefic templates can override."
    4343        />
    4444
     
    7272        <xsl:function name="ibis:getFormattedNumber" as="xs:string"
    7373                ibis:doc="Numeric formatter that localizes the handling of numeric values.
    74                 If a format is not specified then the common.defaultFormat is used."
     74                        If a format is not specified then the common.defaultFormat is used."
    7575        >
    7676                <xsl:param name="number" ibis:doc="Value to be formatted.  If the value is
  • trunk/ibisph-view/src/main/webapp/xslt/_ibis-include.xslt

    r22334 r22707  
    1818                        special match handling.
    1919                       
     20                        The IBIS-PH code in 6-2004 was locked into the xerces 2.6.x parser
     21                        has xinclude support but it must be configured when starting the
     22                        Java JVM or with Java system properties.  Since this was not a safe
     23                        option for some deployments (like a shared app server) the system
     24                        wide property solution is not an option.  To handle being able to
     25                        deploy into environments where we didn't know which XSL engine is
     26                        being used etc. this template match was created which now has some
     27                        ibis specific parameters. 
     28
     29                        See: http://www.sagehill.net/docbookxsl/Xinclude.html
     30
    2031                        At one point had a general CONTENT match.  However, this can not
    2132                        work within an included file because there are some cases where CONTENT
     
    5970
    6071
    61         <xsl:template match="text()" mode="ibis.copy" ibis:doc="copies the text.">
    62 <!-- trims the text - not really needed for wiki - biggest issue with weird text
    63         was page indent on and extra line spacing etc.
    64                 <xsl:value-of select="replace(., '^\s+|\s+$', '')"/>
    65 -->
     72        <xsl:template match="text()" mode="ibis.copy"
     73                ibis:doc="Trims the text - not really needed for wiki - biggest issue
     74                        with weird text was page indent on and extra line spacing etc.
     75                        Another way: [xsl:value-of select=doublequotereplace(., '^\s+|\s+$', '')doublequote/]
     76                "
     77        >
    6678                <xsl:value-of select="."/>
    6779        </xsl:template>
    6880
    69         <!-- Match Copy Mode was lifted from the page.xslt in 4/2007.  That code has a note
    70                 about 4-18-06: removed template code and replaced with the mode="ibis.copy"
    71                 templates above because the namespace was being copied into some HTML elements.
    72                 See: http://www.stylusstudio.com/xsllist/200008/post50850.html
    73         -->
     81
     82        <xsl:template match="@*" mode="ibis.copy"
     83                ibis:doc="Inner '@*' template that copies the non ibis: namespace
     84                        elements and attributes.
     85                "
     86        >
     87                <xsl:copy-of select="."/>
     88        </xsl:template>
     89
     90        <xsl:template match="@ibis:doc" mode="ibis.copy" ibis:doc="Eats ibis:doc attribute"/>
     91        <xsl:template match="ibis:doc"  mode="ibis.copy" ibis:doc="Eats ibis:doc element"/>
     92
    7493
    7594        <!-- The following templates are used to help page developers avoid having to
     
    92111                link to the "indicator/introduction.html" as it will not find the correct
    93112                directory.
    94         -->
    95 
    96         <xsl:template match="@*" mode="ibis.copy" ibis:doc="Inner '@*' template that copies the non ibis: namespace attributes">
    97                 <xsl:copy-of select="."/>
    98         </xsl:template>
    99 
    100         <xsl:template match="@ibis:doc" mode="ibis.copy" ibis:doc="Eats ibis:doc attribute"/>
    101         <xsl:template match="ibis:doc"  mode="ibis.copy" ibis:doc="Eats ibis:doc element"/>
    102 
    103 
    104         <!-- Local IBIS URL adjustment templates.  These templates simply add the
    105                 web application's context path as a prefix to the link reference attribute.
     113
     114                These templates simply add the web application's context path as a prefix
     115                to the link reference attribute.
    106116
    107117                NOTE: The remoteRequestPath_ technique could be applied but these are left
     
    144154                ibis:doc="
    145155                        'ibis:' namespace specific match template which opens and includes
    146                         the document via the 'href' attribute and does an 'apply-template'
     156                        the document via the 'href' attribute and does an 'apply-templates'
    147157                        operation on its contents to process potential sub 'ibis:' matches
    148158                        and to copy its text, attributes, and processing instructions.  This
    149                         is a simple match template that calls the main include template so
    150                         that logic is centralized between this general ibis: match and the
    151                         ConfigurationIncludeCriteriaExclude's config name ibis: match.
    152 
    153                         Provides the IBIS-PH system the ability to do simple xinclude type
    154                         operations.  As of 6-2004 the xerces parser 2.6.x has xinclude support
    155                         but it must be configured when starting the Java JVM or with Java system
    156                         properties.  Since this is not a safe option for some deployments (like
    157                         Utah's state wide ITS app server) the system wide property solution is not
    158                         an option.  To handle being able to deploy into environments where we don't
    159                         know which XSL engine is being used this two step xinclude processing
    160                         was developed.  This option is not nearly as seamless and requires that
    161                         the java controller do 2 transformations - the first being this xinclude
    162                         type transformation with the second being the normal desired page type
    163                         transformation.  Another option was to do the xinclude template inside the
    164                         XSLT as a variable then use that variable for all XML nodes.  This option
    165                         appears to be somewhat slow but it is seamless.
    166 
    167                         See: http://www.sagehill.net/docbookxsl/Xinclude.html
    168                 "
    169         >
    170                 <xsl:call-template name="ibis.include">
    171                         <xsl:with-param name="ibisIncludeElement" select="."/>
    172                 </xsl:call-template>
    173         </xsl:template>
    174 
    175 
    176         <xsl:template name="ibis.include"
    177                 ibis:doc="
    178                         Core processing template called when matching an ibis:include.  Opens
    179                         the document via the 'href' attribute and does an 'apply-template'
    180                         operation on its contents to copy and process content (like sub
    181                         'ibis:include' statements and/or other processing instructions).
    182 
    183                         This code simply copies the contents of the base document and when it
    184                         hits the other processing elements like sub ibis:include elements it
    185                         matches and recursively calls this template to process...
     159                        is a simple match template that calls the main ibis.include template
     160                        so that logic is centralized between this general ibis: match and
     161                        the ConfigurationIncludeCriteriaExclude's config name ibis: match.
    186162
    187163                        If a children-only-flag attribute exists in the element then only the
     
    189165                        for including an element's text without having to include its root
    190166                        element or for custom dimension lists for query modules.
    191                        
     167
    192168                        child-name-list (with list of delimited values) provides the ability
    193169                        to limit included elements (like DIMENSION) and any other include
     
    204180                        ConfigurationIncludeCriteriaExclude) so this attribute as of 7/7/2020
    205181                        can NOT be applied for any QM ibis:includes.
     182                "
     183        >
     184                <xsl:call-template name="ibis.include">
     185                        <xsl:with-param name="url"                  select="@href"/>
     186                        <xsl:with-param name="applyBaseRequestPath" select="exists(@apply-baseRequestPath)"/>
     187                        <xsl:with-param name="childNameList"        select="@child-name-list"/>
     188                        <xsl:with-param name="includeChildrenOnly"  select="exists(@children-only-flag)"/>
     189                </xsl:call-template>
     190        </xsl:template>
     191
     192
     193        <xsl:template name="ibis.include"
     194                ibis:doc="
     195                        Core processing template called when matching an ibis:include or when
     196                        standard call-template xslt processing needs to include a file. 
    206197
    207198                        IMPORTANT NOTE:
     
    216207                "
    217208        >
    218                 <xsl:param name="ibisIncludeElement"/>
    219 
    220                 <xsl:variable name="url" select="if(exists($ibisIncludeElement/@apply-baseRequestPath)) then concat($ibis.baseRequestPath, $ibisIncludeElement/@href) else $ibisIncludeElement/@href"/>
     209                <xsl:param name="url"/>
     210                <xsl:param name="applyBaseRequestPath" select="false()"
     211                        ibis:doc="Optional boolean flag if true() the url parameter used to
     212                                open the document is prefixed with the ibis.baseRequestPath.
     213                        "
     214                />
     215                <xsl:param name="childNameList"
     216                        ibis:doc="Optional blank or csv list of child NAME element values to limit
     217                                included elements (like DIMENSION) and any other includes that
     218                                have the standard NAME element.  This is mostly used for selectively
     219                                including query module dimensions and selections etc.  If set
     220                                this takes precidence over the includeChildrenOnly param.
     221                        "
     222                />
     223                <xsl:param name="includeChildrenOnly"  select="false()"
     224                        ibis:doc="Optional boolean when if true() results in only including
     225                                (and processing) the child sub elements and child text. This is
     226                                useful for including an element's text without having to include
     227                                its root element or for custom dimension lists for query modules.
     228                        "
     229                />
     230
     231                <xsl:variable name="url" select="if($applyBaseRequestPath) then concat($ibis.baseRequestPath, $url) else $url"/>
    221232                <xsl:choose>
    222                         <xsl:when test="exists($ibisIncludeElement/@child-name-list)">
    223                                 <xsl:variable name="names" select="tokenize(normalize-space(replace($ibisIncludeElement/@child-name-list, ',', ' ')), '\s+')"/>
    224                                 <xsl:apply-templates select="document($url)/*/*[NAME=$names]" mode="ibis.copy"/>
     233                        <xsl:when test="$childNameList">
     234                                <xsl:variable name="childNamesToInclude" select="tokenize(normalize-space(replace($childNameList, ',', ' ')), '\s+')"/>
     235<xsl:message select="'~~~~~~~~~~~~~~~~cn'"/>
     236<xsl:message select="$childNamesToInclude"/>
     237<xsl:message select="count($childNamesToInclude)"/>
     238<xsl:message select="count($childNamesToInclude/*)"/>
     239                                <xsl:apply-templates select="document($url)/*/*[NAME=$childNamesToInclude]" mode="ibis.copy"/>
    225240                        </xsl:when>
    226                         <xsl:when test="exists($ibisIncludeElement/@children-only-flag)">
     241                        <xsl:when test="$includeChildrenOnly">
     242<xsl:message select="'~~~~~~~~~~~~~~~~co'"/>
    227243                                <xsl:apply-templates select="document($url, /)/(*/text() | */*)" mode="ibis.copy"/>
    228244                        </xsl:when>
    229245                        <xsl:otherwise>
     246<xsl:message select="'~~~~~~~~~~~~~~~~otherwise'"/>
    230247                                <xsl:apply-templates select="document($url, /)/*" mode="ibis.copy"/>
    231248                        </xsl:otherwise>
     
    234251
    235252
    236         <xsl:template match="*" mode="ibis.copyOnlyChildren" ibis:doc="
    237                         Matches only contained text and elements.  This is mainly used for
    238                         processing CONTENT elements and is the same as calling
    239                         ibisIncludeGetContent.  The ibis:include's children-only-flag
    240                         provides a similar mechanism but is limited to processing just the
    241                         root element of the include file.
    242                 "
    243         >
    244 <!--
    245 GARTH TODO: remove
    246 <xsl:message select="'ibis.copyOnlyChildren'"/>
    247 <xsl:message select="current()/(text() | *)"/>
    248 <xsl:message select="concat('GARTH TOTO:REMOVE THIS MESSAGE.  ibis.copyOnlyChildren.  Container: ', current()/name(), ', Count: ', count(current()//*), ', text: ', current())"/>
    249 -->
     253        <xsl:template match="*" mode="ibis.copyOnlyChildren"
     254                ibis:doc="
     255                        General mechanism to include only child/contained text and elements. 
     256                        This is mainly used for processing HTML_CONTENT type elements where
     257                        the main root element needs to be skipped and only it's contents
     258                        copied.  This is similar behavior as ibis:include's children-only-flag.
     259                "
     260        >
    250261                <xsl:apply-templates select="current()/(text() | *)" mode="ibis.copy"/>
    251262        </xsl:template>
    252263
    253264
    254         <xsl:template name="ibisIncludeGetContent"
     265        <xsl:template name="ibis.contentApplyTemplates"
    255266                ibis:doc="Explicit call to process general CONTENT and returns the
    256267                        actual text and child elements sans the CONTENT container element
    257                         if it exists.  This is potentially safer compared apply
     268                        if it exists.  This is potentially safer compared to direct apply
    258269                        ibis.copyOnlyChildren because of the checking performed.  The apply
    259270                        mode=ibis.copyOnlyChildren is an easier call when there is a CONTENT
     
    292303        </xsl:template>
    293304
    294 
    295305</xsl:stylesheet>
    296306<!-- ============================= End of File ============================= -->
  • trunk/ibisph-view/src/main/webapp/xslt/html/ContentContainer.xslt

    r22407 r22707  
    439439                <xsl:choose>
    440440                        <xsl:when test="$content/CONTENT or ('CONTENT' = $content/name())">
    441                                 <xsl:call-template name="ibisIncludeGetContent">
     441                                <xsl:call-template name="ibis.contentApplyTemplates">
    442442                                        <xsl:with-param name="content" select="$content"/>
    443443                                </xsl:call-template>
  • trunk/ibisph-view/src/main/webapp/xslt/html/HTMLContentPage.xslt

    r22703 r22707  
    146146        >
    147147                <!-- variable is needed to process any ibis:include statements -->
    148                 <xsl:param name="ibisIncludeProcessedContent">
     148                <xsl:param name="applyTemplatesContent">
    149149                        <xsl:apply-templates select="*" mode="ibis.copy"/>
    150150                </xsl:param>
     
    152152                        select="
    153153                                if(exists(SELECTIONS_CONTAINER_ELEMENT_NAME))
    154                                         then $ibisIncludeProcessedContent//*[name()=$ibisIncludeProcessedContent/SELECTIONS_CONTAINER_ELEMENT_NAME]/*
    155                                         else $ibisIncludeProcessedContent
     154                                        then $applyTemplatesContent//*[name()=$applyTemplatesContent/SELECTIONS_CONTAINER_ELEMENT_NAME]/*
     155                                        else $applyTemplatesContent
    156156                        "
    157157                />
    158 <xsl:message select="'=========HTML CONTENT PAGE. ibis:selectionslist'"/>
    159 <xsl:message select="*"/>
     158
    160159                <xsl:call-template name="SelectionsList.processSelections">
    161160                        <xsl:with-param name="containerID"    select="@id"/>
     
    165164                        <xsl:with-param name="headingLevel"   select="@headingLevel"/>
    166165-->
    167 
    168166                        <xsl:with-param name="showSelectionsTitle" select="true()"/>
    169167                        <xsl:with-param name="headingLevel"   select="if(0 != string-length(@headingLevel)) then @headingLevel else 0"/>
  • trunk/ibisph-view/src/main/webapp/xslt/html/community/facts/Page.xslt

    r22317 r22707  
    122122                </table>
    123123        </xsl:template>
     124
     125
     126
     127        <xsl:template match="ibis:CencusTable" mode="ibis.copy">
     128                https://www.census.gov/quickfacts/fact/table/daviscountyutah,US/PST045219
     129                https://www.census.gov/quickfacts/fact/csv/daviscountyutah,US/PST045219
     130                https://www.census.gov/quickfacts/fact/dashboard/daviscountyutah,US/PST045219
     131
     132                basic indicator/measure info example of race:
     133                https://www.census.gov/quickfacts/fact/table/daviscountyutah,US/PST045219
     134                They use an exclamation icon with i inside triangle for mouse hover for
     135                data issues.  They then include that def in the footnotes as well as the
     136                general table value flag definitions.
     137               
     138                Scrollable table with fixed header:
     139                        kendo table: https://docs.telerik.com/kendo-ui/knowledge-base/fixed-headers-grid
     140                        general: https://stackoverflow.com/questions/130564/how-can-i-let-a-tables-body-scroll-but-keep-its-head-fixed-in-place
     141        </xsl:template>
     142
     143
     144
     145
     146
    124147
    125148
  • trunk/ibisph-view/src/main/webapp/xslt/xml/query/module/ConfigurationIncludeCriteriaExclude.xslt

    r22575 r22707  
    135135                <xsl:if test="$configurationNames = $ConfigurationName">
    136136                        <xsl:call-template name="ibis.include">
    137                                 <xsl:with-param name="ibisIncludeElement" select="."/>
     137                                <xsl:with-param name="url" select="@href"/>
    138138                        </xsl:call-template>
    139139                </xsl:if>
Note: See TracChangeset for help on using the changeset viewer.