Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

ontransformnode Event

 

Fires before the style sheet is applied to a node.

System_CAPS_importantImportant

The ontransformnode event does not fire on DOMDocument for style sheets using the XSLT namespace "http://www.w3.org/1999/XSL/Transform". It does, however, fire on DOMDocument for style sheets using the XSL namespace "http://www.w3.org/XSL/Transform/1.0" or where MSXML 3.0 is installed you use "http://www.w3.org/TR/WD-xsl" to declare the older XSL namespace .

boolVal = ontransformnode(nodeCode, nodeData);

 nodeCode

The indicator of the current node in the style sheet.

 nodeData

The indicator of the current node in the XML source data.

True to indicate that transformation processing is to continue; False to indicate that transformation processing should stop.

boolVal = ontransformnode(nodeCode, nodeData)

 nodeCode

The indicator of the current node in the style sheet.

 nodeData

The indicator of the current node in the XML source data.

True to indicate that transformation processing is to continue; False to indicate that transformation processing should stop.

In this example, the XML data island named "target" contains the XML source data, and the XML data island named "ss" contains the XSL Transformations (XSLT) style sheet.

<XML id="target">
  <PEOPLE>
    <PERSON name="Atkinson, Teresa"  />
    <PERSON name="Debroux, Steve" />
    <PERSON name="O'Hara, Robert" />
    <PERSON name="Porzuczek, Peter" />
  </PEOPLE>
</XML>
<XML id="ss">
  <xsl:template match="/" xmlns:xsl="http://www.w3.org/XSL/Transform/1.0">
    <xsl:for-each select="/PEOPLE/PERSON/@name" >   
      <P><xsl:value-of /></P>
    </xsl:for-each>
  </xsl:template>
</XML>

This script contains the Verify function, which sets the ontransformnode property to the event handler, onxform. The event handler is called before the transformation operation on each node so that, given the sample data provided in the data islands, this sample calls the alert several times.

<SCRIPT LANGUAGE="javascript" FOR="window" EVENT="onload">
document.expando = false;
Verify();
</SCRIPT>
<Script LANGUAGE="javascript">
function onxform ( code, doc ) {
  alert("Target document node being transformed:\n\n" + doc.xml +
    "\n\nStylesheet node used for the transform:\n\n" + code.xml);
  if (doc.value == "O'Hara, Robert") 
   return false;  // Stop processing.
  else
   return true;
}
function Verify() {
  target.ontransformnode = onxform;
  var sOut = target.XMLDocument.transformNode(ss.XMLDocument);
  div.innerHTML += sOut;
}
</Script>
<DIV id="div"></DIV>
</BODY>
</HTML>

The return value from the event handler indicates whether to continue processing. In this example, the event handler checks for a particular data value and returns the value "false" to stop transformation processing.

HRESULT ontransformnode(
    IXMLDOMNode *pCode,
    IXMLDOMNode *pData,
    VARIANT vBool);

 pCode[in]

The address of the current node in the XSL style sheet.

 pData[in]

The address of the current node in the XML source data.

 vBool[out, retval]

Boolean. True if transformation processing is to continue; False to stop transformation processing.

S_OK

The value returned if successful.

The event handler for this event can be explicitly set using the ontransformnode property.

This member is an extension of the Worldwide Web Consortium (W3C) Document Object Model (DOM).

Implemented in: MSXML 3.0 and MSXML 6.0

         IXMLDOMDocument/DOMDocument       

Show:
© 2016 Microsoft