[OpenBIOS] [Patch] to fix XSLT build issue

Alex Owen r.alex.owen at gmail.com
Sun Apr 8 23:15:26 CEST 2007


Hi I was having a problem compiling openbios on the lastest debian release.
I thought it may have been a problem with the xsltproc version in
debian... however the debian maintainer Mike Hommey tells me that the
issue is in the openbios code. He has generated a patch which I am
forwarding (attached) which he tells me fixes the openbios XSLT.

Regards
Alex Owen


---------- Forwarded message ----------
From: Mike Hommey <mh at glandium.org>
Date: 08-Apr-2007 17:02
Subject: Re: Bug#401337: test case for error "Unexpected XSLT element 'param'"
To: Alex Owen <r.alex.owen at gmail.com>, 401337-done at bugs.debian.org
Cc: Nicolas Haller <nicolas at boiteameuh.org>


On Fri, Feb 23, 2007 at 09:32:48PM +0000, Alex Owen
<r.alex.owen at gmail.com> wrote:
> Sorry missed a line:
>
> >mkdir /var/tmp/testcase
> >cd /var/tmp/testcase
> >svn co svn://openbios.org/openbios/openbios-devel -r 113
> >cd openbios-devel
> config/scripts/switch-arch x86
> >make xml
> >###output starts###
> >Cleaning up... ok
> >Initializing build tree...ok.
> >Creating target Makefile...warning: failed to load external entity
> >"rules.xml"
> >runtime error: file config/xml/dictionary.xsl line 13 element param
> >Unexpected XSLT element 'param'.
> >runtime error: file config/xml/dictionary.xsl line 22 element if
> >Variable 'conditions' has not been declared.
> >make: *** [xml] Error 10
> >###output ends###

Okay, I have been able to reproduce the bug... and it's not a bug.
The reason why it didn't fail before is that previous versions of
libxslt were lax on xsl:param. You are using xsl:param where
xsl:variable is to be used. xsl:param can only be top-level or a direct
child of an xsl:template.

Attached here is a diff to fix openbios-devel's xsl stylesheet. With
this patch applied, it works with xsltproc from etch.

Mike
-------------- next part --------------
Index: config/xml/util.xsl
===================================================================
--- config/xml/util.xsl	(revision 113)
+++ config/xml/util.xsl	(working copy)
@@ -44,8 +44,8 @@
   
   <xsl:choose>
    <xsl:when test="$expression!=''">
-    <xsl:param name="value"><xsl:value-of select="document('../../config.xml')//option[@name=$confexpr]/attribute::value"/></xsl:param>
-    <xsl:param name="type"><xsl:value-of select="document('../../config.xml')//option[@name=$confexpr]/attribute::type"/></xsl:param>
+    <xsl:variable name="value"><xsl:value-of select="document('../../config.xml')//option[@name=$confexpr]/attribute::value"/></xsl:variable>
+    <xsl:variable name="type"><xsl:value-of select="document('../../config.xml')//option[@name=$confexpr]/attribute::type"/></xsl:variable>
     <xsl:choose>
      <xsl:when test="$type='boolean'">
       <xsl:choose>
Index: config/xml/dictionary.xsl
===================================================================
--- config/xml/dictionary.xsl	(revision 113)
+++ config/xml/dictionary.xsl	(working copy)
@@ -10,14 +10,14 @@
     <xsl:for-each select="//dictionary">
      <xsl:sort select="@name"/>
     
-     <xsl:param name="conditions">
+     <xsl:variable name="conditions">
       <xsl:text>0</xsl:text>
       <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
        <xsl:call-template name="resolve-condition">
         <xsl:with-param select="@condition" name="expression"/>
        </xsl:call-template>
       </xsl:for-each>
-     </xsl:param>
+     </xsl:variable>
      
     <xsl:if test="$conditions = 0">
      
@@ -31,26 +31,26 @@
     <!-- Add all forth source files to their dictionaries -->
     <xsl:for-each select="//dictionary/object">
     
-     <xsl:param name="path">
+     <xsl:variable name="path">
       <xsl:for-each select="ancestor::build">
        <xsl:call-template name="get-dirname">
         <xsl:with-param select="@base" name="path"/>
        </xsl:call-template>
       </xsl:for-each>
-     </xsl:param>
+     </xsl:variable>
  
-     <xsl:param name="conditions">
+     <xsl:variable name="conditions">
       <xsl:text>0</xsl:text>
       <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
        <xsl:call-template name="resolve-condition">
         <xsl:with-param select="@condition" name="expression"/>
        </xsl:call-template>
       </xsl:for-each>
-     </xsl:param>
+     </xsl:variable>
  
-     <xsl:param name="dictname">
+     <xsl:variable name="dictname">
       <xsl:value-of select="parent::*/@name"/>
-     </xsl:param>
+     </xsl:variable>
 
      <xsl:if test="$conditions=0">
       <xsl:value-of select="$dictname"/><xsl:text>-DICTIONARY:=$(</xsl:text>
@@ -68,22 +68,22 @@
     <xsl:for-each select="//dictionary">
     <xsl:sort select="@name"/>
 
-     <xsl:param name="outer-conditions">
+     <xsl:variable name="outer-conditions">
       <xsl:text>0</xsl:text>
       <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
        <xsl:call-template name="resolve-condition">
         <xsl:with-param select="@condition" name="expression"/>
        </xsl:call-template>
       </xsl:for-each>
-     </xsl:param>
+     </xsl:variable>
      
     <xsl:if test="$outer-conditions = 0">
     
     <xsl:if test="not(preceding::dictionary/@name = @name)">
-     <xsl:param name="name"><xsl:value-of select="@name"/></xsl:param>
-     <xsl:param name="init">
+     <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
+     <xsl:variable name="init">
       <xsl:value-of select="(//dictionary[@name=$name]/attribute::init)[last()]"/>
-     </xsl:param>
+     </xsl:variable>
      <!-- dictionary name and dependencies -->
      <xsl:text>$(ODIR)/</xsl:text>
      <xsl:value-of select="@name"/><xsl:text>.dict: $(</xsl:text>
@@ -97,22 +97,22 @@
      <xsl:text>&#9;$(ODIR)/forthstrap</xsl:text>
      <xsl:for-each select="//dictionary[@name = @name]">
  
-      <xsl:param name="conditions">
+      <xsl:variable name="conditions">
        <xsl:text>0</xsl:text>
        <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
         <xsl:call-template name="resolve-condition">
          <xsl:with-param select="@condition" name="expression"/>
         </xsl:call-template>
        </xsl:for-each>
-      </xsl:param>
+      </xsl:variable>
      
-      <xsl:param name="path">
+      <xsl:variable name="path">
        <xsl:for-each select="ancestor::build">
         <xsl:call-template name="get-dirname">
          <xsl:with-param select="@base" name="path"/>
         </xsl:call-template>
        </xsl:for-each>
-      </xsl:param>
+      </xsl:variable>
       
       <xsl:if test="$conditions = 0">
        <xsl:text> -I</xsl:text>
@@ -139,14 +139,14 @@
     <xsl:for-each select="//dictionary">
     <xsl:sort select="@name"/>
     
-     <xsl:param name="conditions">
+     <xsl:variable name="conditions">
       <xsl:text>0</xsl:text>
       <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
        <xsl:call-template name="resolve-condition">
         <xsl:with-param select="@condition" name="expression"/>
        </xsl:call-template>
       </xsl:for-each>
-     </xsl:param>
+     </xsl:variable>
      
     <xsl:if test="$conditions = 0">
     
Index: config/xml/object.xsl
===================================================================
--- config/xml/object.xsl	(revision 113)
+++ config/xml/object.xsl	(working copy)
@@ -24,22 +24,22 @@
   <!-- create rules for all compile objects -->
   <xsl:for-each select="//object[(ancestor-or-self::*)[@target = $target]]">
   
-   <xsl:param name="path">
+   <xsl:variable name="path">
     <xsl:for-each select="ancestor::build">
      <xsl:call-template name="get-dirname">
       <xsl:with-param select="@base" name="path"/>
      </xsl:call-template>
     </xsl:for-each>
-   </xsl:param>
+   </xsl:variable>
      
-   <xsl:param name="conditions">
+   <xsl:variable name="conditions">
     <xsl:text>0</xsl:text>
     <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
      <xsl:call-template name="resolve-condition">
       <xsl:with-param select="@condition" name="expression"/>
      </xsl:call-template>
     </xsl:for-each>
-   </xsl:param>
+   </xsl:variable>
      
    <xsl:if test="$conditions=0">
 
@@ -78,14 +78,14 @@
   <!-- Create linker targets for all executables -->
   <xsl:for-each select="//executable">
  
-   <xsl:param name="outer-conditions">
+   <xsl:variable name="outer-conditions">
     <xsl:text>0</xsl:text>
     <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
      <xsl:call-template name="resolve-condition">
       <xsl:with-param select="@condition" name="expression"/>
      </xsl:call-template>
     </xsl:for-each>
-   </xsl:param>
+   </xsl:variable>
    
    <xsl:if test="$outer-conditions = 0">
     <xsl:if test="(ancestor-or-self::*)[@target = $target]">
@@ -98,24 +98,24 @@
      <!-- add all objects -->
      <xsl:for-each select="object">
   
-      <xsl:param name="conditions">
+      <xsl:variable name="conditions">
        <xsl:text>0</xsl:text>
        <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
         <xsl:call-template name="resolve-condition">
          <xsl:with-param select="@condition" name="expression"/>
         </xsl:call-template>
        </xsl:for-each>
-      </xsl:param>
+      </xsl:variable>
       
       <xsl:if test="$conditions=0">
        
-       <xsl:param name="path">
+       <xsl:variable name="path">
         <xsl:for-each select="ancestor::build">
          <xsl:call-template name="get-dirname">
           <xsl:with-param select="@base" name="path"/>
          </xsl:call-template>
         </xsl:for-each>
-       </xsl:param>
+       </xsl:variable>
       
        <xsl:text> $(ODIR)/</xsl:text>
        <xsl:value-of select="$target"/>
@@ -130,14 +130,14 @@
      <!-- external objects last -->
      <xsl:for-each select="external-object">
  
-      <xsl:param name="conditions">
+      <xsl:variable name="conditions">
        <xsl:text>0</xsl:text>
        <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
         <xsl:call-template name="resolve-condition">
          <xsl:with-param select="@condition" name="expression"/>
         </xsl:call-template>
        </xsl:for-each>
-      </xsl:param>
+      </xsl:variable>
       
       <xsl:if test="$conditions=0">
        <xsl:text> $(ODIR)/</xsl:text>
@@ -166,14 +166,14 @@
   <xsl:for-each select="//library">
    <xsl:sort select="@name"/>
  
-   <xsl:param name="outer-conditions">
+   <xsl:variable name="outer-conditions">
     <xsl:text>0</xsl:text>
     <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
      <xsl:call-template name="resolve-condition">
       <xsl:with-param select="@condition" name="expression"/>
      </xsl:call-template>
     </xsl:for-each>
-   </xsl:param>
+   </xsl:variable>
    
    <xsl:if test="$outer-conditions = 0">
 
@@ -196,29 +196,29 @@
      </xsl:choose>
      <xsl:text>: </xsl:text>
        
-     <xsl:param name="name"><xsl:value-of select="@name"/></xsl:param>
+     <xsl:variable name="name"><xsl:value-of select="@name"/></xsl:variable>
        
      <!-- enumerate all objects for library target -->
      <xsl:for-each select="//library[@name=$name]/object">
      
-      <xsl:param name="conditions">
+      <xsl:variable name="conditions">
        <xsl:text>0</xsl:text>
        <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
         <xsl:call-template name="resolve-condition">
          <xsl:with-param select="@condition" name="expression"/>
         </xsl:call-template>
        </xsl:for-each>
-      </xsl:param>
+      </xsl:variable>
      
       <xsl:if test="$conditions=0">
         
-       <xsl:param name="path">
+       <xsl:variable name="path">
         <xsl:for-each select="ancestor::build">
          <xsl:call-template name="get-dirname">
           <xsl:with-param select="@base" name="path"/>
          </xsl:call-template>
         </xsl:for-each>
-       </xsl:param>
+       </xsl:variable>
   
        <xsl:text>$(ODIR)/</xsl:text>
        <xsl:value-of select="$target"/>
@@ -234,14 +234,14 @@
      <!-- external objects last -->
      <xsl:for-each select="external-object">
  
-      <xsl:param name="conditions">
+      <xsl:variable name="conditions">
        <xsl:text>0</xsl:text>
        <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
         <xsl:call-template name="resolve-condition">
          <xsl:with-param select="@condition" name="expression"/>
         </xsl:call-template>
        </xsl:for-each>
-      </xsl:param>
+      </xsl:variable>
       
       <xsl:if test="$conditions=0">
        <xsl:text> $(ODIR)/</xsl:text>
@@ -267,14 +267,14 @@
   <xsl:for-each select="//library">
    <xsl:if test="object[(ancestor-or-self::*)[@target = $target]]">
  
-    <xsl:param name="conditions">
+    <xsl:variable name="conditions">
      <xsl:text>0</xsl:text>
      <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
       <xsl:call-template name="resolve-condition">
        <xsl:with-param select="@condition" name="expression"/>
       </xsl:call-template>
      </xsl:for-each>
-    </xsl:param>
+    </xsl:variable>
     <xsl:if test="$conditions=0">
     <xsl:text> $(ODIR)/</xsl:text>
     <xsl:text>lib</xsl:text>
@@ -300,14 +300,14 @@
   <xsl:for-each select="//executable">
    <xsl:if test="(ancestor-or-self::*)[@target = $target]">
 
-    <xsl:param name="conditions">
+    <xsl:variable name="conditions">
      <xsl:text>0</xsl:text>
      <xsl:for-each select="(ancestor-or-self::*)[@condition!='']">
       <xsl:call-template name="resolve-condition">
        <xsl:with-param select="@condition" name="expression"/>
       </xsl:call-template>
      </xsl:for-each>
-    </xsl:param>
+    </xsl:variable>
     <xsl:if test="$conditions=0">
      <xsl:text> $(ODIR)/</xsl:text>
      <xsl:value-of select="@name"/>


More information about the OpenBIOS mailing list