sysdeftools/joinandparesysdef.xsl
branchHighFidelityModel
changeset 151 84b123918d3f
child 206 eccc98839441
equal deleted inserted replaced
150:8d58b930d36e 151:84b123918d3f
       
     1 <?xml version="1.0"?>
       
     2  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
       
     3 <!--Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     4 	All rights reserved.
       
     5 	This component and the accompanying materials are made available
       
     6 	under the terms of the License "Eclipse Public License v1.0"
       
     7 	which accompanies this distribution, and is available
       
     8 	at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     9 
       
    10 	Initial Contributors:
       
    11 	Nokia Corporation - initial contribution.
       
    12 	Contributors:
       
    13 	Description:
       
    14 	Create a stand-alone sysdef from a linked set of fragments, paring down to just a set of items of the desired rank.
       
    15 -->
       
    16  	<xsl:output method="xml" indent="yes"/>
       
    17 
       
    18 	<!-- comma-separated list of IDs in the literal from as the document they appear in (ie same namespace prefix) -->
       
    19 <xsl:param name="pare"/>		
       
    20 
       
    21 
       
    22 	<!-- the rank item to pare down. This will remove any item of that rank EXCEPT those in $pare -->
       
    23 <xsl:param name="rank">package</xsl:param>
       
    24 
       
    25 <xsl:variable name="pare-list" select="concat(',',translate(normalize-space($pare),' ',','),',')"/> <!-- accept spaces in pare. Pad with commas to make computing easier -->
       
    26 
       
    27 <xsl:include href="joinsysdef.xsl"/>  
       
    28 
       
    29 <xsl:template match="/SystemDefinition[systemModel]">
       
    30 	<xsl:apply-templates select="." mode="join">
       
    31 		<xsl:with-param name="filename" select="$path"/>
       
    32 		<xsl:with-param name="data" select="current()"/> <!-- just has to be non-empty -->
       
    33 	</xsl:apply-templates>
       
    34 </xsl:template>
       
    35 
       
    36 <xsl:template match="*" mode="filter"> <!-- use this to strip out the unwanted items -->
       
    37 	<xsl:param name="item" />
       
    38 	<xsl:if test="$rank=name($item) and not(contains($pare-list,concat(',',$item/@id,',')))">hide</xsl:if>
       
    39 </xsl:template>
       
    40 
       
    41 </xsl:stylesheet>