Author: jshaw
Date: Sun Jul 22 12:54:12 2007
New Revision: 3457
URL:
http://source.netsurf-browser.org?rev=3457&view=rev
Log:
Rewritten produce-specific-attribute to handle casts properly. IDL to C names are now
held in ctypes.xml. produce-specific-method and <assertEquals> are not yet
reimplemented.
Added:
trunk/dom/test/transform/ctypes.xml
Modified:
trunk/dom/test/transform/test-to-c.xsl
Added: trunk/dom/test/transform/ctypes.xml
URL:
http://source.netsurf-browser.org/trunk/dom/test/transform/ctypes.xml?rev...
==============================================================================
--- trunk/dom/test/transform/ctypes.xml (added)
+++ trunk/dom/test/transform/ctypes.xml Sun Jul 22 12:54:12 2007
@@ -1,0 +1,56 @@
+<?xml version="1.0" ?>
+<types>
+ <primitive idl="int" c="int"/>
+
+ <type idl="Attr" c="dom_attr"/>
+ <type idl="Document" c="dom_document">
+ <attribute idl="documentElement" c="document_element"/>
+ <method idl="createElement" c="create_element"/>
+ <method idl="createDocumentFragment"
c="create_document_fragment"/>
+ <method idl="createTextNode" c="create_text_node"/>
+ <method idl="createComment" c="create_comment"/>
+ <method idl="createCDATASection" c="create_cdata_section"/>
+ <method idl="createProcessingInstruction"
c="create_processing_instruction"/>
+ <method idl="createAttribute" c="create_attribute"/>
+ <method idl="createEntityReference"
c="create_entity_reference"/>
+ <method idl="getElementsByTagName"
c="get_elements_by_tag_name"/>
+
+ </type>
+ <type idl="DocumentType" c="dom_document_type">
+
+ </type>
+ <type idl="DOMString" c="dom_string">
+ </type>
+ <type idl="Element" c="dom_element">
+ <attribute idl="tagName" c="tag_name"/>
+ <method idl="getAttribute" c="get_attribute"/>
+ <method idl="setAttribute" c="set_attribute"/>
+ <method idl="removeAttribute" c="remove_attribute"/>
+ <method idl="getAttributeNode" c="get_attribute_node"/>
+ <method idl="setAttributeNode" c="set_attribute_node"/>
+ <method idl="removeAttributeNode"
c="remove_attribute_node"/>
+ <method idl="getElementsByTagName"
c="get_elements_by_tag_name"/>
+ </type>
+ <type idl="Node" c="dom_node">
+ <attribute idl="nodeName" c="node_name"/>
+ <attribute idl="nodeValue" c="node_value"/>
+ <attribute idl="nodeType" c="node_type">
+ <override-type>dom_node_type</override-type>
+ </attribute>
+ <attribute idl="parentNode" c="parent_node"/>
+ <attribute idl="childNodes" c="child_nodes"/>
+ <attribute idl="firstChild" c="first_child"/>
+ <attribute idl="lastChild" c="last_child"/>
+ <attribute idl="previousSibling" c="previous_sibling"/>
+ <attribute idl="nextSibling" c="next_sibling"/>
+ <attribute idl="ownerDocument" c="owner_document"/>
+ <method idl="insertBefore" c="insert_before"/>
+ <method idl="replaceChild" c="replace_child"/>
+ <method idl="removeChild" c="remove_child"/>
+ <method idl="appendChild" c="append_child"/>
+ <method idl="hasChildNodes" c="has_child_nodes"/>
+ <method idl="cloneNode" c="clone_node"/>
+ </type>
+ <type idl="Text" c="dom_text">
+ </type>
+</types>
Modified: trunk/dom/test/transform/test-to-c.xsl
URL:
http://source.netsurf-browser.org/trunk/dom/test/transform/test-to-c.xsl?...
==============================================================================
--- trunk/dom/test/transform/test-to-c.xsl (original)
+++ trunk/dom/test/transform/test-to-c.xsl Sun Jul 22 12:54:12 2007
@@ -5,13 +5,24 @@
-->
<xsl:stylesheet version="1.0"
-
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-
xmlns:str="http://exslt.org/strings"><!-- TODO: exslt not currently
used -->
+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+ <!--
+ The interfaces document is generated from the W3C test suite.
+ It contains the signatures of DOM interfaces, their methods
+ and attributes
+ -->
<xsl:param
name="interfaces-docname">dom1-interfaces.xml</xsl:param>
+
+ <!--
+ The ctypes document maps interfaces, methods and attributes in the
+ interfaces document to their C counterparts, proving the ability to
+ override names and types.
+ -->
+ <xsl:param name="ctypes-docname">ctypes.xml</xsl:param>
<xsl:param
name="target-uri-base">http://www.w3.org/2001/DOM-Test-Suite...
<xsl:output method="text" encoding="UTF-8"/>
<xsl:variable name="domspec"
select="document($interfaces-docname)"/>
-
+ <xsl:variable name="ctypes"
select="document($ctypes-docname)"/>
<!-- swallow any text which we don't understand -->
<xsl:template match="text()" mode="body"/>
@@ -39,7 +50,6 @@
<xsl:when test="$method">
<xsl:call-template name="produce-method">
<xsl:with-param name="method" select="$method"/>
- <!-- TODO: vardefs not yet done <xsl:with-param name="vardefs"
select="$vardefs"/>-->
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
@@ -51,9 +61,7 @@
<xsl:variable name="attribute"
select="$domspec/library/interface[not($interface) or @name =
$interface]/attribute[@name = $feature]"/>
<xsl:choose>
<xsl:when test="$attribute">
- <xsl:call-template name="produce-attribute">
- <!-- TODO: vardefs not yet done <xsl:with-param name="vardefs"
select="$vardefs"/> -->
- </xsl:call-template>
+ <xsl:call-template name="produce-attribute"/>
</xsl:when>
<xsl:otherwise>
@@ -141,25 +149,25 @@
<xsl:template match="*[local-name() = 'var']"
mode="body">
<xsl:text> </xsl:text>
- <xsl:call-template name="convert_var_declaration">
- <xsl:with-param name="var_type" select="@type"/>
+ <xsl:call-template name="produce-var-type-declaration">
+ <xsl:with-param name="var-type" select="./@type"/>
</xsl:call-template>
<xsl:value-of select="@name"/>;
</xsl:template>
<xsl:template match="*[local-name() = 'if']"
mode="body">
-<xsl:text>
+ <xsl:text>
if (</xsl:text><xsl:apply-templates select="*[1]"
mode="body"/><xsl:text>) {
-</xsl:text>
-<xsl:apply-templates select="*[position() > 1 and local-name() !=
'else']" mode="body"/>
-<xsl:text> }</xsl:text>
-<xsl:for-each select="*[local-name() = 'else']">
- <xsl:text> else {
-</xsl:text>
- <xsl:apply-templates mode="body"/>
+ </xsl:text>
+ <xsl:apply-templates select="*[position() > 1 and local-name() !=
'else']" mode="body"/>
<xsl:text> }</xsl:text>
-</xsl:for-each>
-<xsl:text>
+ <xsl:for-each select="*[local-name() = 'else']">
+ <xsl:text> else {
+</xsl:text>
+ <xsl:apply-templates mode="body"/>
+ <xsl:text> }</xsl:text>
+ </xsl:for-each>
+ <xsl:text>
</xsl:text>
</xsl:template>
@@ -177,44 +185,18 @@
<xsl:variable name="interface" select="@interface"/>
<xsl:call-template name="produce-specific-method">
<xsl:with-param name="method"
select="$domspec/library/interface[@name = $interface]/method[@name =
$methodName]"/>
- <!--<xsl:with-param name="vardefs"
select="$vardefs"/>-->
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="methods"
select="$domspec/library/interface/method[@name = $methodName]"/>
<xsl:call-template name="produce-specific-method">
<xsl:with-param name="method" select="$methods[1]"/>
- <!--<xsl:with-param name="vardefs"
select="$vardefs"/>-->
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
-<xsl:template name="produce-specific-method">
- <xsl:param name="method"/>
- <xsl:variable name="current" select="."/>
- <xsl:variable name="obj" select="@obj"/>
- <xsl:variable name="var" select="//*[local-name() = 'var' and
@name = $obj]"/>
-
- <xsl:text> </xsl:text>
- <xsl:call-template name="convert_method_name">
- <xsl:with-param name="method_target"><xsl:value-of
select="$var/@type"/></xsl:with-param>
- <xsl:with-param name="method_name"><xsl:value-of
select="$method/@name"/></xsl:with-param>
- </xsl:call-template>
- <xsl:text>(</xsl:text><xsl:value-of select="@obj"/>
- <xsl:for-each select="$method/parameters/param">
- <xsl:variable name="paramDef" select="."/>
- <xsl:text>, </xsl:text>
- <xsl:value-of select="$current/@*[name() = $paramDef/@name]"/>
- </xsl:for-each>
- <xsl:if test="@var">
- <xsl:text>, &</xsl:text><xsl:value-of
select="@var"/>
- </xsl:if>
- <xsl:text>);</xsl:text>
-</xsl:template>
-
<xsl:template name="produce-attribute">
- <!-- <xsl:param name="vardefs"/> -->
<xsl:variable name="attribName" select="local-name(.)"/>
<xsl:choose>
<!-- if interface is specified -->
@@ -222,97 +204,159 @@
<xsl:variable name="interface" select="@interface"/>
<xsl:call-template name="produce-specific-attribute">
<xsl:with-param name="attribute"
select="$domspec/library/interface[@name = $interface]/attribute[@name =
$attribName]"/>
- <!-- <xsl:with-param name="vardefs" select="$vardefs"/>
-->
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="produce-specific-attribute">
- <xsl:with-param name="attribute"
select="$domspec/library/interface/attribute[@name = $attribName]"/>
- <!-- <xsl:with-param name="vardefs" select="$vardefs"/>
-->
+ <xsl:with-param name="attribute"
select="$domspec/library/interface/attribute[@name = $attribName]"/>
</xsl:call-template>
</xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
+ </xsl:choose>
+</xsl:template>
+
+<!--
+Produce a statement to get or set an attribute.
+If @var is specified, the accessor is called and @var is given the result value.
+err = dom_document_get_doctype(doc, &docType);
+assert(err == DOM_NO_ERR);
+
+If @value is specified, the mutator is called and @value is used as the parameter
argument.
+
+-->
<xsl:template name="produce-specific-attribute">
- <!-- <xsl:param name="vardefs"/> -->
+ <!--
+ An <attribute> node in the $domspec document.
+ -->
<xsl:param name="attribute"/>
- <xsl:variable name="obj" select="@obj"/>
- <xsl:variable name="value" select="@value"/>
- <xsl:variable name="var" select="@var"/>
- <xsl:variable name="obj_type" select="//*[local-name() = 'var'
and @name = $obj]/@type"/>
- <xsl:variable name="interface_type"
select="$domspec/library/interface[attribute = $attribute]/@name"/>
- <!-- check if attribute name starts with is -->
+
+ <!-- the object which contains the attribute -->
+ <xsl:variable name="obj" select="@obj"/>
+
+ <!-- the <var> for the $obj -->
+ <xsl:variable name="obj-var" select="//*[local-name() = 'var'
and @name = $obj]"/>
+
+ <!--
+ The C type for the object's type containing $attribute.
+ This may be the object's own type, or a supertype. For example, $obj
+ may be an Element, but the nodeValue attribute is a member of the Node
+ supertype.
+ Note that this is the <type> element itself, not the @c attribute.
+ -->
+ <xsl:variable name="obj-ctype" select="$ctypes/types/type[@idl =
$attribute/parent::interface/@name]"/>
+
+ <!--
+ The C name of the attribute. This is either $attribute/@name, or
+ the value in $ctypes if it overrides it.
+ -->
+ <xsl:variable name="attribute-cname">
+ <xsl:choose>
+ <xsl:when test="$obj-ctype/attribute[@idl = $attribute/@name]/@c">
+ <xsl:value-of select="$obj-ctype/attribute[@idl =
$attribute/@name]/@c"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$attribute/@name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:message>attribute-cname: <xsl:value-of
select="$attribute-cname"/></xsl:message>
+
+ <!--
+ The attribute type. This is either $attribute/@type, or
+ the <override-type> in $ctypes if it is specified.
+ The resulting attribute type may be an IDL-style name (e.g. DocumentType)
+ or a C-style name (e.g. dom_node_type).
+ -->
+ <xsl:variable name="attribute-type">
+ <xsl:choose>
+ <xsl:when test="$obj-ctype/attribute[@idl =
$attribute/@name]/override-type">
+ <xsl:value-of select="$obj-ctype/attribute[@idl =
$attribute/@name]/override-type/text()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$attribute/@type"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:text> err = </xsl:text>
<xsl:if test="@value">
- <!-- TODO: set attribute to a value -->
+ <xsl:text>_set_</xsl:text>
</xsl:if>
- <!--
- call an attribute accessor. this takes the form
- err = dom_<objecttype>_get_<attributename>(<objectstruct>,
&<targetattributestruct>);
- -->
<xsl:if test="@var">
- <xsl:text>
- err = </xsl:text>
- <xsl:call-template name="convert_var_type">
- <xsl:with-param name="var_type"><xsl:value-of
select="$interface_type"/></xsl:with-param>
- </xsl:call-template>
+ <xsl:variable name="var" select="@var"/>
+ <xsl:variable name="var-type" select="//*[local-name() =
'var' and @name = $var]/@type"/>
+
+ <xsl:value-of select="$obj-ctype/@c"/>
<xsl:text>_get_</xsl:text>
- <xsl:call-template name="convert_attribute_name">
- <xsl:with-param name="attribute_name"><xsl:value-of
select="$attribute/@name"/></xsl:with-param>
- </xsl:call-template>
+ <xsl:value-of select="$attribute-cname"/>
<xsl:text>(</xsl:text>
- <!-- cast to target interface if this is different from the type of the variable
@obj -->
<xsl:call-template name="cast">
- <xsl:with-param name="vartype" select="$obj_type"/>
- <xsl:with-param name="reqtype" select="$interface_type"/>
- </xsl:call-template>
- <xsl:value-of select="@obj"/>
+ <xsl:with-param name="var-type" select="//*[local-name() =
'var' and @name = $obj]/@type"/>
+ <xsl:with-param name="interface-type"
select="$obj-ctype/@c"/>
+ </xsl:call-template>
+ <xsl:value-of select="$obj"/>
<xsl:text>, </xsl:text>
- <!-- TODO: cast the result to the that expected by the function
- e.g. int nodeType; dom_node_get_node_type(node, (dom_node_type *) &nodeType);
- -->
- <xsl:call-template name="attribute-result-cast">
- <xsl:with-param name="vartype" select="//*[local-name() =
'var' and @name = $var]/@type"/>
- <xsl:with-param name="attribute" select="$attribute"/>
- </xsl:call-template>
- <xsl:text>&</xsl:text><xsl:value-of
select="@var"/>
- <xsl:text>);
+ <xsl:call-template name="cast">
+ <xsl:with-param name="var-type" select="$var-type"/>
+ <xsl:with-param name="interface-type"
select="$attribute-type"/>
+ </xsl:call-template>
+ <xsl:text>&</xsl:text>
+ <xsl:value-of select="@var"/>
+ <xsl:text>);</xsl:text>
+ </xsl:if>
+ <xsl:text>
assert(err == DOM_NO_ERR);
</xsl:text>
-
+</xsl:template>
+
+<xsl:template name="produce-specific-method">
+ <xsl:param name="method"/>
+</xsl:template>
+
+<xsl:template name="cast">
+ <!-- the variable's type (e.g. Document, dom_node_type or int) -->
+ <xsl:param name="var-type"/>
+
+ <!-- the required type (e.g. Document or dom_node_type) -->
+ <xsl:param name="interface-type"/>
+
+ <!-- the variable's C-style type -->
+ <xsl:variable name="var-ctype">
+ <xsl:call-template name="get-ctype">
+ <xsl:with-param name="type" select="$var-type"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <!-- the interface's C-style type -->
+ <xsl:variable name="interface-ctype">
+ <xsl:call-template name="get-ctype">
+ <xsl:with-param name="type" select="$interface-type"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:if test="$var-ctype != $interface-ctype">
+ <xsl:text>(</xsl:text>
+ <xsl:call-template name="produce-var-type-declaration">
+ <xsl:with-param name="var-type" select="$interface-ctype"/>
+ </xsl:call-template>
+ <xsl:text>) </xsl:text>
</xsl:if>
</xsl:template>
-<xsl:template name="cast">
- <xsl:param name="vartype"/>
- <xsl:param name="reqtype"/>
- <xsl:choose>
- <xsl:when test="$vartype = $reqtype">
-
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>(</xsl:text>
- <xsl:call-template name="convert_var_declaration">
- <xsl:with-param name="var_type"><xsl:value-of
select="$reqtype"/></xsl:with-param>
- </xsl:call-template>
- <xsl:text>) </xsl:text>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template name="attribute-result-cast">
- <!-- the type of the target result variable, as defined by <var @type> -->
- <xsl:param name="vartype"/>
- <!-- an <attribute> from the $domspec -->
- <xsl:param name="attribute"/>
- <xsl:choose>
- <xsl:when test="$attribute/@name = 'nodeType'">
- <xsl:text>(</xsl:text>
- <xsl:call-template name="convert_var_declaration">
- <xsl:with-param name="var_type"
select="'NodeType'"/>
- </xsl:call-template>
- <xsl:text>) </xsl:text>
- </xsl:when>
+<xsl:template name="get-ctype">
+ <!--
+ a type (e.g. Document, dom_node_type or int)
+ if $type is already a C-style type, or was a primitive, this is
+ used instead
+ -->
+ <xsl:param name="type"/>
+
+ <xsl:choose>
+ <xsl:when test="$ctypes/types/type[@idl = $type]/@c">
+ <xsl:value-of select="$ctypes/types/type[@idl = $type]/@c"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="$type"/>
+ </xsl:otherwise>
</xsl:choose>
</xsl:template>
@@ -338,152 +382,45 @@
</xsl:template>
<xsl:template match="*[local-name() = 'assertEquals']"
mode="body">
- <xsl:variable name="actual" select="@actual"/>
- <xsl:variable name="var_type" select="//*[local-name() = 'var'
and @name = $actual]/@type"/>
-
- <!-- implement equality test depending upon $var_type -->
- <xsl:choose>
- <xsl:when test="$var_type = 'DOMString'">
-
- <xsl:text>
- /* begin assertEquals */
- struct dom_string *match;
-
- err = dom_string_create_from_const_ptr(</xsl:text>
- <!-- use the first variable we find that's of @type 'Document' -->
- <xsl:value-of select="//*[local-name() = 'var' and @type =
'Document'][1]/@name"/>
- <xsl:text>, (uint8_t *) </xsl:text><xsl:value-of
select="@expected"/><xsl:text>,
- SLEN(</xsl:text><xsl:value-of
select="@expected"/><xsl:text>), &match);
- assert(err == DOM_NO_ERR); <!-- TODO: pull this line out, since it's reused
everywhere -->
-
- assert(</xsl:text>
- <xsl:choose>
- <xsl:when test="@ignoreCase = 'true'">
- <xsl:text>dom_string_icmp</xsl:text>
- </xsl:when>
- <xsl:when test="@ignoreCase = 'auto'">
- <!--
- TODO: implement auto case comparison (see java's
DOMTestCase.assertEqualsAutoCase()
- -->
- <xsl:message><assertEquals ignoreCase='auto'> not
supported</xsl:message>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>dom_string_cmp</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text>(</xsl:text><xsl:value-of
select="@actual"/><xsl:text>, match) == 0);
-</xsl:text>
- </xsl:when>
- <xsl:when test="$var_type = 'int'">
- <xsl:text>
- assert(</xsl:text><xsl:value-of select="@actual"/><xsl:text>
== </xsl:text><xsl:value-of
select="@expected"/><xsl:text>);</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:message terminate="no">Warning in assertEquals template:
don't know how to compare variable type '<xsl:value-of
select="$var_type"/>'</xsl:message>
+ <!-- TODO: implement -->
+</xsl:template>
+
+<!--
+================================
+Helper templates
+================================
+-->
+
+<xsl:template name="produce-var-type-declaration">
+ <!-- a type (e.g. Document, dom_node_type or int) -->
+ <xsl:param name="var-type"/>
+ <xsl:variable name="var-ctype">
+ <xsl:call-template name="get-ctype">
+ <xsl:with-param name="type" select="$var-type"/>
+ </xsl:call-template>
+ </xsl:variable>
+
+ <xsl:choose>
+ <xsl:when test="$ctypes/types/primitive[@c = $var-ctype]">
+ <!-- TODO: support the overriding of primitive name in ctypes document -->
+ <xsl:value-of select="$var-ctype"/><xsl:text> </xsl:text>
+ </xsl:when>
+ <xsl:when test="$ctypes/types/type[@c = $var-ctype]">
+ <xsl:text>struct </xsl:text>
+ <xsl:value-of select="$ctypes/types/type[@c = $var-ctype]/@c"/>
+ <xsl:text> *</xsl:text>
+ </xsl:when>
+
+ <!-- assume this is not a struct, and not a primitive (e.g. an enum) -->
+ <xsl:otherwise>
+ <xsl:value-of select="$var-ctype"/>
+ <xsl:text> *</xsl:text>
</xsl:otherwise>
</xsl:choose>
- <xsl:text>
- /* end assertEquals */
-</xsl:text>
-</xsl:template>
-
-<!-- helper templates -->
-
-<xsl:template name="convert_var_declaration">
- <xsl:param name="var_type"/>
- <!-- TODO: move these definitions out to a separate XML file -->
- <xsl:variable name="is_struct" select="$var_type != 'int' and
$var_type != 'NodeType'"/>
- <xsl:variable name="is_pointer" select="$var_type !=
'int'"/>
- <xsl:message>is_struct <xsl:value-of
select="$is_struct"/></xsl:message>
- <xsl:if test="$is_struct">
- <xsl:text>struct </xsl:text>
- </xsl:if>
- <xsl:call-template name="convert_var_type">
- <xsl:with-param name="var_type" select="$var_type"/>
- </xsl:call-template>
- <xsl:text> </xsl:text>
- <xsl:if test="$is_pointer">
- <xsl:text>*</xsl:text>
- </xsl:if>
-</xsl:template>
-
-<!--
-Convert a variable type to its equivalent C name. C names are lower case
-separated by underscores.
--->
-<xsl:template name="convert_var_type">
-<!-- TODO: convert certain types, e.g. from DocumentType to dom_document_type -->
- <xsl:param name="var_type"/>
- <xsl:choose>
- <xsl:when test="$var_type = 'Document'">
- <xsl:text>dom_document</xsl:text>
- </xsl:when>
- <xsl:when test="$var_type = 'DocumentType'">
- <xsl:text>dom_document_type</xsl:text>
- </xsl:when>
- <xsl:when test="$var_type = 'DOMString'">
- <xsl:text>dom_string</xsl:text>
- </xsl:when>
- <xsl:when test="$var_type = 'Element'">
- <xsl:text>dom_element</xsl:text>
- </xsl:when>
- <xsl:when test="$var_type = 'Node'">
- <xsl:text>dom_node</xsl:text>
- </xsl:when>
- <xsl:when test="$var_type = 'NodeType'">
- <xsl:text>dom_node_type</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$var_type"/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<xsl:template name="convert_attribute_name">
- <xsl:param name="attribute_name"/>
- <xsl:message><xsl:value-of
select="$attribute_name"/></xsl:message>
- <xsl:choose>
- <xsl:when test="$attribute_name = 'nodeName'">
- <xsl:text>node_name</xsl:text>
- </xsl:when>
- <xsl:when test="$attribute_name = 'nodeValue'">
- <xsl:text>node_value</xsl:text>
- </xsl:when>
- <xsl:when test="$attribute_name = 'nodeType'">
- <xsl:text>node_type</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <!-- assume no conversion is needed -->
- <xsl:value-of select="$attribute_name"/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<!--
-Method name is in the form dom_<type>_<methodName>
-For example, dom_document_create_element
--->
-<xsl:template name="convert_method_name">
- <xsl:param name="method_target"/>
- <xsl:param name="method_name"/>
-
- <xsl:call-template name="convert_var_type">
- <xsl:with-param name="var_type"><xsl:value-of
select="$method_target"/></xsl:with-param>
- </xsl:call-template>
- <xsl:text>_</xsl:text>
- <xsl:choose>
- <xsl:when test="$method_name = 'createElement'">
- <xsl:text>create_element</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <!-- assume no conversion is needed -->
- <xsl:value-of select="$method_name"/>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-<!--
-stolen from test-to-java.xsl
+</xsl:template>
+
+<!--
+Taken from test-to-java.xsl
Prepends every line with asterisks, suitable for use in a block comment
-->
<xsl:template name="emit-description">