DYNTOXML
COMMAND SYNTAX
DYNTOXML(array, xsl, result)
SYNTAX ELEMENTS
Convert the array to XML using the optimal xsl to transform
XML = DYNTOXML(array, '', result)
Takes the contents of the dynamic array held in an array, and returns a generic XML representation of that array or an error
(result=0 OK; result<>0 Bad);
EXAMPLE
a = "Tom" : @AM : "Dick" : @AM : "Harry" xml = DYNTOXML(a, '', result) CRT xml
SCREEN OUTPUT
<?xml version="1.0" encoding ="ISO-8859-1"?>
<array>
<data attribute="1" value="1" subvalue="1">Tom</data>
<data attribute="2" value="1" subvalue="1">Dick</data>
<data attribute="3" value="1" subvalue="1">Harry</data>
</array>
If a style sheet is passed in the second parameter, it performs a transform to give a different format of XML.
EXAMPLE
xml = DYNTOXML(a, xsl, result) CRT xml
SCREEN OUTPUT
<mycustomer>
<firstname>Tom</firstname>
<lastname>Dick</lastname>
<address>Harry</address>
</mycustomer>
XSL CONTENTS
<xsl:template match="/">
<mycustomer>
<xsl:for-each select="array/data">
<xsl:if test="@attribute=1">
<firstname>
<xsl:value-of select="."/>
</firstname>
</xsl:if>
<xsl:if test="@attribute=2">
<lastname>
<xsl:value-of select="."/>
</lastname>
</xsl:if>
<xsl:if test="@attribute=3">
<address>
<xsl:value-of select="."/>
</address>
</xsl:if>
<xsl:if test="@attribute=4">
<address2>
<xsl:value-of select="."/>
</address2>
</xsl:if>
Last update: Sat, 16 Jul 2022 15:34