View Ticket
Not logged in
Ticket UUID: 40456c18c9c49cc97ba3ef731c5c92f2605620cc
Title: Look into XSLT transform on wsdl parse - document - replace?
Status: New Type: Documentation
Severity: Minor Priority: Immediate
Subsystem: Client_Side Resolution: Open
Assigned to: unassigned
Last Modified: 2017-11-14 23:05:15
Version Found In: trunk
Description & Comments:
When a WSDL is parsed for a WS call, an xslt transform is used:
$tmpdoc xslt $::WS::Utils::xsltSchemaDom wsdlDoc

The schema is defined as:

dom parse {
<xsl:stylesheet
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    version="1.0">

  <xsl:template priority="1" match="comment()"/>

  <xsl:template match="xs:choice">
      <xsl:apply-templates/>
  </xsl:template>

  <!-- Copy all the attributes and other nodes -->
  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>
    } ::WS::Utils::xsltSchemaDom

I asked on clt, how eventually SOAP 1.2 nodes may be removed: (Title: "TDOM Delete the nodes in a given namespace", Date: 2017-11-10 10:32 UTC).

Gerald Leister wrote by private mail, that this is done by the upper xslt transform.

Rolf Ade commented, that an xslt transform is quite overkill for this action. It would be better to a) ignore those nodes when reading using a correct select or b) delete them manually by:

foreach node [$doc selectNodes //soap12:*[not(ancestor::soap12:*)]] {
    set parent [$node parentNode]
    if {$parent ne ""} {
        # Only document element hasn't a parent node
        $parent removeNode $node
    }
}

This ticket is to remember all this and to at least document what the xslt does.


anonymous added on 2017-11-14 23:05:15 UTC:
Read of course:

foreach node [$doc selectNodes {//soap12:*[not(ancestor::soap12:*)]}] { ... }

(Added {} around the XPath expression to protect the predicate.)

Still guaranteed untested!