1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3 <!-- Magic sauce copied from a manual. This fragment basically
4 copies everything except for stuff that explicitly matches with
5 the templates defined below. In the case of such a match, the
6 matched node is treated differently.-->
7 <xsl:template match="@* | node()">
9 <xsl:apply-templates select="@* | node()"/>
12 <!-- End of magic sauce -->
14 <!-- Read in the value of the argument. -->
15 <xsl:variable name="max-node-kbps" select="//RSpec//target-context/argument[name='max-node-kbps']/value"/>
16 <xsl:variable name="blacklist_suffix" select="//RSpec//target-context/argument[name='on-legacy-node']/value"/>
18 <!-- Modify NodeSpec for which kbps > max-link-kbps -->
19 <xsl:template match="NodeSpec/max_rate">
21 <xsl:when test=". > $max-node-kbps">
22 <max_rate><xsl:value-of select="$max-node-kbps"/></max_rate>
25 <xsl:copy-of select="."/>
30 <!-- Fill in missing kbps values -->
31 <xsl:template match="NodeSpec[not(max_rate)]">
33 <xsl:when test="(not($blacklist_suffix) or not(contains(@name,$blacklist_suffix)))">
34 <!-- We're OK on this node, simply copy the nodespec -->
35 <xsl:copy-of select="."/>
39 <xsl:when test="not(max_rate)">
41 <xsl:copy-of select="@*"/>
42 <max_rate><xsl:value-of select="$max-node-kbps"/></max_rate>
47 <xsl:when test=". > $max-node-kbps">
48 <max_rate><xsl:value-of select="$max-node-kbps"/></max_rate>
51 <xsl:copy-of select="."/>
59 <xsl:template match="sfatables-input"/>