equal
deleted
inserted
replaced
104 <block> |
104 <block> |
105 <xsl:apply-templates mode="copy" select="@id|@name|@span|@level|@levels"/><!-- valid attribuites for 2.0 --> |
105 <xsl:apply-templates mode="copy" select="@id|@name|@span|@level|@levels"/><!-- valid attribuites for 2.0 --> |
106 <xsl:choose> |
106 <xsl:choose> |
107 <xsl:when test="@href"> |
107 <xsl:when test="@href"> |
108 <xsl:variable name="this" select="."/> |
108 <xsl:variable name="this" select="."/> |
|
109 <xsl:variable name="prefixmap" select="ancestor::SystemDefinition/*/meta[@rel='link-mapping']/map-prefix[starts-with(current()/@href,@link)]"/> |
109 <xsl:for-each select="document(@href,.)/SystemDefinition/*"> |
110 <xsl:for-each select="document(@href,.)/SystemDefinition/*"> |
110 <xsl:variable name="my-id"><xsl:apply-templates mode="normalize-id" select="@id"/></xsl:variable> |
111 <xsl:variable name="my-id"><xsl:apply-templates mode="normalize-id" select="@id"/></xsl:variable> |
111 <xsl:variable name="other-id"><xsl:apply-templates mode="normalize-id" select="$this/@id"/></xsl:variable> |
112 <xsl:variable name="other-id"><xsl:apply-templates mode="normalize-id" select="$this/@id"/></xsl:variable> |
112 <xsl:if test="$my-id != $other-id"> |
113 <xsl:if test="$my-id != $other-id"> |
113 <xsl:message terminate="yes">ERROR: Package IDs do not match: <xsl:value-of select="$my-id"/> vs <xsl:value-of select="$other-id"/></xsl:message> |
114 <xsl:message terminate="yes">ERROR: Package IDs do not match: <xsl:value-of select="$my-id"/> vs <xsl:value-of select="$other-id"/></xsl:message> |
122 <xsl:copy-of select="."/> |
123 <xsl:copy-of select="."/> |
123 </xsl:if> |
124 </xsl:if> |
124 </xsl:for-each> |
125 </xsl:for-each> |
125 <xsl:apply-templates select="*|comment()"> |
126 <xsl:apply-templates select="*|comment()"> |
126 <xsl:with-param name="path"> |
127 <xsl:with-param name="path"> |
127 <xsl:call-template name="normpath"> |
128 <xsl:choose> |
128 <xsl:with-param name="path" select="concat($path,'/',$this/@href)"/> |
129 <xsl:when test="$prefixmap"> |
129 </xsl:call-template> |
130 <xsl:call-template name="normpath"> |
|
131 <xsl:with-param name="path"> |
|
132 <xsl:apply-templates select="$prefixmap/@to"/> |
|
133 <xsl:value-of select="substring-after($this/@href,$prefixmap/@link)"/> |
|
134 </xsl:with-param> |
|
135 </xsl:call-template> |
|
136 </xsl:when> |
|
137 <xsl:when test="starts-with($this/@href,'/')"> <!-- absolute path --> |
|
138 <xsl:call-template name="normpath"> |
|
139 <xsl:with-param name="path" select="$this/@href"/> |
|
140 </xsl:call-template> |
|
141 </xsl:when> |
|
142 <xsl:when test="contains($this/@href,'://')"> <!-- generic URI --> |
|
143 <xsl:call-template name="normpath"> |
|
144 <xsl:with-param name="path" select="substring-after($this/@href,'://')"/> |
|
145 </xsl:call-template> |
|
146 </xsl:when> |
|
147 <xsl:otherwise> |
|
148 <xsl:call-template name="normpath"> |
|
149 <xsl:with-param name="path" select="concat($path,'/',$this/@href)"/> |
|
150 </xsl:call-template> |
|
151 </xsl:otherwise> |
|
152 </xsl:choose> |
130 </xsl:with-param> |
153 </xsl:with-param> |
131 </xsl:apply-templates> |
154 </xsl:apply-templates> |
132 </xsl:for-each> |
155 </xsl:for-each> |
133 </xsl:when> |
156 </xsl:when> |
134 <xsl:otherwise> |
157 <xsl:otherwise> |
209 <xsl:template match="@mrp|@bldFile"><xsl:param name="path"/> |
232 <xsl:template match="@mrp|@bldFile"><xsl:param name="path"/> |
210 <xsl:attribute name="{name()}"> |
233 <xsl:attribute name="{name()}"> |
211 <xsl:choose> |
234 <xsl:choose> |
212 <xsl:when test="../@root"> |
235 <xsl:when test="../@root"> |
213 <xsl:variable name="pre" select="substring-before(substring-after($root,concat(' ',../@root,'=')),' ')"/> |
236 <xsl:variable name="pre" select="substring-before(substring-after($root,concat(' ',../@root,'=')),' ')"/> |
214 <xsl:if test="$pre!=''"><xsl:value-of select="concat($pre,'/')"/></xsl:if> |
237 <xsl:value-of select="$pre"/> |
|
238 <xsl:if test="$pre!='' and $pre!='/'">/</xsl:if> |
|
239 </xsl:when> |
|
240 <xsl:when test="$srcroot='/'"> <!-- treat all paths as absolute --> |
|
241 <xsl:value-of select="$srcroot"/> |
215 </xsl:when> |
242 </xsl:when> |
216 <xsl:when test="$srcroot!=''"> |
243 <xsl:when test="$srcroot!=''"> |
217 <xsl:value-of select="concat($srcroot,'/')"/> |
244 <xsl:value-of select="concat($srcroot,'/')"/> |
218 </xsl:when> |
245 </xsl:when> |
219 </xsl:choose> |
246 </xsl:choose> |
238 <xsl:template match="meta"/> <!-- strip all meta tags --> |
265 <xsl:template match="meta"/> <!-- strip all meta tags --> |
239 |
266 |
240 <xsl:template match="meta[info/@contract]"> <!-- except contract --> |
267 <xsl:template match="meta[info/@contract]"> <!-- except contract --> |
241 <xsl:copy-of select="info/@contract"/> |
268 <xsl:copy-of select="info/@contract"/> |
242 </xsl:template> |
269 </xsl:template> |
|
270 |
|
271 |
|
272 <xsl:template match="meta[@rel='link-mapping']/map-prefix/@to"> |
|
273 <xsl:choose> |
|
274 <xsl:when test="starts-with(.,'/')"><xsl:value-of select="substring(.,2)"/></xsl:when> <!-- absolute paths in 3.0 are relative in 2.0 --> |
|
275 <xsl:otherwise><xsl:value-of select="."/></xsl:otherwise> |
|
276 </xsl:choose> |
|
277 </xsl:template> |
|
278 |
243 |
279 |
244 <xsl:template match="@id" mode="normalize-id"> |
280 <xsl:template match="@id" mode="normalize-id"> |
245 <xsl:choose> |
281 <xsl:choose> |
246 <xsl:when test="contains(@id,':')"><xsl:value-of select="substring-after(@id,':')"/></xsl:when> |
282 <xsl:when test="contains(@id,':')"><xsl:value-of select="substring-after(@id,':')"/></xsl:when> |
247 <xsl:otherwise><xsl:value-of select="@id"/></xsl:otherwise> |
283 <xsl:otherwise><xsl:value-of select="@id"/></xsl:otherwise> |