toXML
The toXML
function is used to include a part of the source XML document into the target document.
If the output produces XML, then the returned node will be included in the DOM of the resulting file. Otherwise, the returned node will be serialized before being inserted as a standard value.
Syntax
c4i:toXML(xPath)
Parameters
xPath
The XPath to the XML to include
Examples
Given the following STEP XML :
<STEP-ProductInformation>
<Products>
<Product ID="PRD1">
<Values>
<Value AttributeID="ATT_1">Test Value</Value>
</Values>
</Product>
</Products>
</STEP-ProductInformation>
The toXML
function can be used as shown in the following examples :
Producing XML files
- Product:
product://MyProductsRoot/Products/Product[./@ID]:
- ./@ID: ./@ID
- c4i:toXML(.): .
<MyProductsRoot>
<Products>
<Product ID="PRD1">
<Values>
<Value AttributeID="ATT_1">Test Value</Value>
</Values>
</Product>
</Products>
</MyProductsRoot>
Producing text files
- Product:
product[id]:
- ./@ID: id
- c4i:toXML(.): xml
id;xml
PRD1;<Product ID="PRD1"><Values><Value AttributeID="ATT_1">Test Value</Value></Values></Product>