Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Custom XSLT – syntax problem
- This topic has 4 replies, 1 voice, and was last updated 9 years, 1 month ago by
community-content.
-
AuthorPosts
-
-
January 30, 2007 at 7:29 PM #17485
Hello,
I’m new at both BizTalk and XSLT. I think it’s a syntax problem I’m having with a custom XSLT. In the script below I make a DBLookup to a table “tblPurchaseOrder” in a SQL Database for several field values. Next I have <xsl:if test="($var:vInternalFlg)"> to test one of these values (which has boolean datatype) to determine whether an XML record should be produced. Unfortunately no matter whether this field value is true or false an XML record is produced. When I change the test to
<xsl:if test="not($var:vInternalFlg) and not($var:vRAFlg)" >
No XML record is produced – even when the field values for $var:vInternalFlg & $var:vRAFlg are both false.
<xsl:output indent="yes" omit-xml-declaration="yes" method="xml" version="1.0" />
<xsl:template match="/">
<xsl:apply-templates select="/s0:IMFile" />
</xsl:template>
<xsl:template match="/s0:IMFile">
<ns0:APSFile>
<xsl:for-each select="//Invoice/InvoiceHeader">
<xsl:if test="not(FreightAmt='')">
<xsl:variable name="var:v8" select="string(BCSPONo/text())" />
<xsl:variable name="var:v6" select="ScriptNS0:DBLookup(0 , string(BCSPONo/text()) , 'Provider=SQLOLEDB;Server=npvm02;Database=BCS_ProcurementDB;Integrated Security=SSPI;' , 'tblPurchaseOrder' , 'BCSOrderID')" />
<xsl:variable name="var:v7" select="ScriptNS0:DBValueExtract(string($var:v6) , 'ClientRef')" />
<xsl:variable name="var:vMatterID" select="ScriptNS0:DBValueExtract(string($var:v6) ,'MatterID')" />
<xsl:variable name="var:vInternalFlg" select="ScriptNS0:DBValueExtract(string($var:v6) ,'InternalFlg')" />
<xsl:variable name="var:vRAFlg" select="ScriptNS0:DBValueExtract(string($var:v6) ,'RAFlg')" />
<xsl:variable name="var:vErrMsg" select="ScriptNS0:DBErrorExtract(string($var:v6))" />
<xsl:if test="($var:vInternalFlg)">
<Record>
<IMInvoice>
<xsl:value-of select="IMInvoiceNo/text()" />
</IMInvoice>
<LineNO>
<xsl:text>0</xsl:text>
</LineNO>
etc
Any help and/or where I can learn this syntax would be much appreciated.
Cheers
Stable
-
January 31, 2007 at 8:25 AM #17494
Hi Stable,
Can you please output the value of that boolean so we can see if it is not some type mismatch between technologies?
Is it -1 or 0? True or false?
I think values have a tendency to be genericized to "string" when dealing with XSLT.
You need to look at that value and make the eval appropriate to the value you are getting.
– weak architect
-
January 31, 2007 at 1:11 PM #17502
Hi 'weak architect',
Thanks for your tip, you are right about the genericized to "string". Once I changed the test to
<xsl:if test="($var:vInternalFlg)='False'">
It works fine. Any recommendations on tutorials and/or books where I can come up to speed on XSLT?
cheers
Stable
-
February 1, 2007 at 5:31 AM #17508
stable – I like http://www.w3schools.com/
They have decent XSLT and XPATH info.
Also Jeni Tennison has a site with great info
www.jenitennison.com
-wa
-
February 1, 2007 at 4:06 PM #17522
Hi wa,
Thanks very much for those sites.
cheers
Stable
-
-
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.