I have an applescript that is using xmltransform to transform a xml using and external xlst file. I would like to add a variable in applescript to be picked up by the xslt file.
The satimage dictionary talks about the use of xsl params as part of xmltransform but i cannot find any examples.
Using the template XMLTransform xmlFile with xsltFile in outputpath how would i define the variables both in the applescript and in the following
xsl file example.
<xsl:stylesheet version="1.0">
<xsl:param name="vb1" value="'unknown'"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="xmeml/list/name">
<xsl:value-of select="{$vb1}"/>
</xsl:template>
</xsl:stylesheet>
Applescript snippet
set vb1 to "Hello" as string
XMLTransform xmlFile with xsltFile1 in outputpathtemp xsl params vb1
The current applescript returns “cannot make vb1 into record”.
I am now looking at using the following but it is returning NULL in the XML
set vb1 to {s:"'hello'"}
XMLTransform xmlFile with xsltFile1 in outputpathtemp xsl string params vb1
the input is
<xmeml>
<list>
<name>IMaName</name>
<!-- other nodes -->
</list>
</xmeml>
the current output is
<xmeml>
<list>
<name/>
<!-- other nodes -->
</list>
</xmeml>
Can anyone Help please?
many thanks.
Here is the Answer:
applescript
XSLT
Thanks.