[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
(Apologies to xml-dev readers who may have seen my related message)
It's not a theoretical breakthrough or anything like that, but I thought xsl-list readers might be interested in a working example of calling a Web Service from XSLT.
For files like this:
you can run (with msxsl.exe - the "https:" URL appears to break saxon) the following transform:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:cdyne="http://ws.cdyne.com/">
<xsl:output indent="yes"/>
<xsl:variable name="CheckCC" select="'https://secure.cdyne.com/creditcardverify/luhnchecker.asmx/CheckCC?CardNumber='" />
<!-- -->
<!-- do a "pass-through" type transform -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<!-- -->
<!-- for everything except elements in the target namespace -->
<xsl:template match="card">
<xsl:copy>
<xsl:attribute name="CardValid">
<xsl:value-of select="document(concat($CheckCC, @number))/cdyne:ReturnIndicator/cdyne:CardValid = 'true'" />
</xsl:attribute>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<!-- -->
</xsl:stylesheet>
to get each card element marked up with a CardValid attribute containing a boolean true or false.
Not something I'd use in production lightly, and limited to Web Services with an HTTP GET binding, but satisfactory in its way.
Francis.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
[xsl] calling a web service from XSLT
Subject: [xsl] calling a web service from XSLT From: Francis Norton <francis@xxxxxxxxxxx> Date: Fri, 31 May 2002 16:27:29 +0100 |
(Apologies to xml-dev readers who may have seen my related message)
It's not a theoretical breakthrough or anything like that, but I thought xsl-list readers might be interested in a working example of calling a Web Service from XSLT.
For files like this:
<cardlist> <card number="00000000000000"/> </cardlist>
you can run (with msxsl.exe - the "https:" URL appears to break saxon) the following transform:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:cdyne="http://ws.cdyne.com/">
<xsl:output indent="yes"/>
<xsl:variable name="CheckCC" select="'https://secure.cdyne.com/creditcardverify/luhnchecker.asmx/CheckCC?CardNumber='" />
<!-- -->
<!-- do a "pass-through" type transform -->
<xsl:template match="@* | node()">
<xsl:copy>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<!-- -->
<!-- for everything except elements in the target namespace -->
<xsl:template match="card">
<xsl:copy>
<xsl:attribute name="CardValid">
<xsl:value-of select="document(concat($CheckCC, @number))/cdyne:ReturnIndicator/cdyne:CardValid = 'true'" />
</xsl:attribute>
<xsl:apply-templates select="@* | node()"/>
</xsl:copy>
</xsl:template>
<!-- -->
</xsl:stylesheet>
to get each card element marked up with a CardValid attribute containing a boolean true or false.
Not something I'd use in production lightly, and limited to Web Services with an HTTP GET binding, but satisfactory in its way.
Francis.
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: AW: [xsl] Finding node having m, Antonio Fiol Bonnín | Thread | Re: [xsl] calling a web service fro, Frank Chen |
Re: AW: [xsl] Netscape XSLT ?, Thomas B. Passin | Date | Re: [xsl] searching and replacing, normbishop1 |
Month |