sysmodelgen/core/filtersysdef-module.xsl
branchHighFidelityModel
changeset 165 ba562c1e2717
parent 152 5acf50bbb618
equal deleted inserted replaced
164:8309dda95234 165:ba562c1e2717
     6 <!-- sysdef is the "data" element from the Model XML that filters are called on -->  
     6 <!-- sysdef is the "data" element from the Model XML that filters are called on -->  
     7 <xsl:template match="sysdef" mode="filter" priority="1"><xsl:param name="item"/>
     7 <xsl:template match="sysdef" mode="filter" priority="1"><xsl:param name="item"/>
     8 	<xsl:variable name="result">		<!-- the ordered list of all ignores and filters, the last value is the one to note --> 
     8 	<xsl:variable name="result">		<!-- the ordered list of all ignores and filters, the last value is the one to note --> 
     9 		<xsl:choose>
     9 		<xsl:choose>
    10 			<xsl:when test="$item[self::meta]">
    10 			<xsl:when test="$item[self::meta]">
    11 				<!-- TODO -->
    11 				<xsl:apply-templates select="ignore|../ignore" mode="filter">
       
    12 					<xsl:with-param name="item" select="$item"/>
       
    13 				</xsl:apply-templates>
    12 			</xsl:when>
    14 			</xsl:when>
    13 			<xsl:when test="$item[self::unit]">	
    15 			<xsl:when test="$item[self::unit]">	
    14 				<!-- only filter to determine if it's shown -->
    16 				<!-- only filter to determine if it's shown -->
    15 				<xsl:apply-templates select="filter|../filter" mode="filter">
    17 				<xsl:apply-templates select="filter|../filter" mode="filter">
    16 					<xsl:with-param name="item" select="$item"/>
    18 					<xsl:with-param name="item" select="$item"/>
    19 			<xsl:when test="$item/@id">	
    21 			<xsl:when test="$item/@id">	
    20 				<!-- has an ID, so, use vars to save trouble of recalulating each time -->
    22 				<!-- has an ID, so, use vars to save trouble of recalulating each time -->
    21 				<xsl:variable name="id"><xsl:apply-templates select="$item/@id" mode="my-id"/></xsl:variable>			<!-- namespaceless ID of this here -->
    23 				<xsl:variable name="id"><xsl:apply-templates select="$item/@id" mode="my-id"/></xsl:variable>			<!-- namespaceless ID of this here -->
    22 				<xsl:variable name="ns"><xsl:apply-templates select="$item/@id" mode="my-namespace"/></xsl:variable>	<!-- ID's namespace -->
    24 				<xsl:variable name="ns"><xsl:apply-templates select="$item/@id" mode="my-namespace"/></xsl:variable>	<!-- ID's namespace -->
    23 				<!-- use ignore and filter to determine if it's shown-->
    25 				<!-- use ignore and filter to determine if it's shown-->
    24 				<xsl:apply-templates select="ignore|filter|../ignore|../filter" mode="filter">
    26 				<xsl:apply-templates select="ignore[not(@meta or @meta-type)]|filter|../ignore[not(@meta or @meta-type)]|../filter" mode="filter">
    25 					<xsl:with-param name="id" select="$id"/>
    27 					<xsl:with-param name="id" select="$id"/>
    26 					<xsl:with-param name="ns" select="$ns"/>
    28 					<xsl:with-param name="ns" select="$ns"/>
    27 					<xsl:with-param name="item" select="$item"/>
    29 					<xsl:with-param name="item" select="$item"/>
    28 				</xsl:apply-templates>
    30 				</xsl:apply-templates>
    29 			</xsl:when>
    31 			</xsl:when>
    62 
    64 
    63 <!-- ignore by human-readable name and item type (deprecated) -->
    65 <!-- ignore by human-readable name and item type (deprecated) -->
    64 <xsl:template match="ignore[not(@ref) and @name and @type]" mode="filter" priority="1"><xsl:param name="item"/>
    66 <xsl:template match="ignore[not(@ref) and @name and @type]" mode="filter" priority="1"><xsl:param name="item"/>
    65 	<!-- old way of doing this -->
    67 	<!-- old way of doing this -->
    66 	<xsl:if test="$item/@name=@name and name($item)= @type"> ignore </xsl:if>
    68 	<xsl:if test="$item/@name=@name and name($item)= @type"> ignore </xsl:if>
       
    69 </xsl:template>
       
    70 
       
    71 
       
    72 <xsl:template match="ignore[@meta]" mode="filter" priority="2"><xsl:param name="item"/>
       
    73 	<!-- ignore certain metadata rel values -->
       
    74 	<xsl:if test="$item[self::meta] and (@meta='*' or $item/@rel=@meta  or (not($item/@rel) and @meta='Generic'))
       
    75 		and
       
    76 		(not(@meta-type) or  $item/@type=@meta-type or  (@meta-type='auto' and not($item/@type)))"> ignore </xsl:if>
       
    77 </xsl:template>
       
    78 
       
    79 <xsl:template match="ignore[@meta-type]" mode="filter" priority="1"><xsl:param name="item"/>
       
    80 	<!-- ignore certain metadata types, no rel values specified -->
       
    81 	<xsl:if test="$item[self::meta] and $item/@type=@meta-type or (not($item/@type) and @meta-type='Generic')"> ignore </xsl:if>
    67 </xsl:template>
    82 </xsl:template>
    68  
    83  
    69 <xsl:template match="filter" mode="filter"  priority="1"><xsl:param name="item"/>
    84 <xsl:template match="filter" mode="filter"  priority="1"><xsl:param name="item"/>
    70 	<xsl:variable name="att" select="@select"/>
    85 	<xsl:variable name="att" select="@select"/>
    71 	<xsl:choose>
    86 	<xsl:choose>