[netcf-devel] [PATCH] redhat-put.xsl: transform STP value to "on/off"

Martin Wilck martin.wilck at ts.fujitsu.com
Mon Nov 18 11:35:15 UTC 2013


Some tools (e.g. NetworkManager) use "yes"/"no" in config files
rather than "on/off". netcf needs to transform this in order to conform
with the schema.
---
 data/xml/redhat-put.xsl | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/data/xml/redhat-put.xsl b/data/xml/redhat-put.xsl
index 267d9cd..88e6d73 100644
--- a/data/xml/redhat-put.xsl
+++ b/data/xml/redhat-put.xsl
@@ -77,7 +77,17 @@
       <xsl:call-template name="interface-addressing"/>
       <bridge>
         <xsl:if test="node[@label = 'STP']">
-          <xsl:attribute name="stp"><xsl:value-of select="node[@label = 'STP']/@value"/></xsl:attribute>
+          <xsl:choose>
+            <xsl:when test="node[@label = 'STP']/@value = 'yes'">
+              <xsl:attribute name="stp">on</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="node[@label = 'STP']/@value = 'no'">
+              <xsl:attribute name="stp">off</xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:attribute name="stp"><xsl:value-of select="node[@label = 'STP']/@value"/></xsl:attribute>
+            </xsl:otherwise>
+          </xsl:choose>
         </xsl:if>
         <xsl:if test="node[@label = 'DELAY']">
           <xsl:attribute name="delay"><xsl:value-of select="node[@label = 'DELAY']/@value"/></xsl:attribute>
-- 
1.8.3.1



More information about the netcf-devel mailing list