marvin-zhao / pyang

Automatically exported from code.google.com/p/pyang
0 stars 0 forks source link

DSDL plugin gen-dsrl.xsl with target "notification" bug #70

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This XSLT will generate an invalid dsrl file with invalid paths which contain 
an unbound prefix named "en". A proper namespace is never generated in the 
output file (xmlns:en="urn:ietf:params:xml:ns:netconf:notification:1.0").

Offending template:

<xsl:template name="nc-namespace">
      <xsl:choose>
        <xsl:when test="$target='config' or $target='get-reply' or
                        $target='get-config-reply' or $target='data'
                        or $target='rpc' or $target='rpc-reply'">
          <xsl:variable name="dummy">
            <nc:dummy/>
          </xsl:variable>
          <xsl:copy-of select="exsl:node-set($dummy)/*/namespace::*"/>
        </xsl:when>
        <xsl:when test="$target='notification'">
          <xsl:variable name="dummy">
            <en:dummy/>
          </xsl:variable>
          <xsl:copy-of select="exsl:node-set($dummy)/namespace::*"/>
        </xsl:when>
      </xsl:choose>
  </xsl:template>

Should be:

<xsl:template name="nc-namespace">
      <xsl:choose>
        <xsl:when test="$target='config' or $target='get-reply' or
                        $target='get-config-reply' or $target='data'
                        or $target='rpc' or $target='rpc-reply'">
          <xsl:variable name="dummy">
            <nc:dummy/>
          </xsl:variable>
          <xsl:copy-of select="exsl:node-set($dummy)/*/namespace::*"/>
        </xsl:when>
        <xsl:when test="$target='notification'">
          <xsl:variable name="dummy">
            <en:dummy/>
          </xsl:variable>
          <xsl:copy-of select="exsl:node-set($dummy)/*/namespace::*"/>
        </xsl:when>
      </xsl:choose>
  </xsl:template>

Note the change of xpath which follows after the call to exsl:node-set (++"/*").

Original issue reported on code.google.com by jernej.t...@gmail.com on 14 Mar 2012 at 2:43

GoogleCodeExporter commented 9 years ago

Original comment by mbj4...@gmail.com on 19 Apr 2012 at 2:35

GoogleCodeExporter commented 9 years ago
Fixed, thanks.

Original comment by lada.lho...@gmail.com on 20 Apr 2012 at 7:10