Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Standard Functoids and Inline XLST Template (Scripting Functoid)
- This topic has 3 replies, 1 voice, and was last updated 9 years, 10 months ago by
community-content.
-
AuthorPosts
-
-
May 22, 2008 at 11:42 AM #19718
Because I need to go from One-to-Many I was forced to do an entire map using XSLT…not fun, but I learned a lot 🙂
The problem I am having now is that I need to do a DB Lookup and Pass the value into my XLST Template as a parameter. My scripting functoids are not connected to either the input or output; how it knows which of the numerous templates to run first I have no idea. It seems as though any other functoids besides the scripting fuctoids do not function.
To test this I got rid of the DB Lookup and Extractor and replaced them with a String Concat and hard-coded a value. The value from the String Concat functoid never gets passed to the template.
I know my Map/XSLT works, it has been running in a Live environment for a number of months now. The DB lookup is an addition. I was pulling my hair out trying to get the DB Lookup to work until I replaced it with the String Concat and realized that NOTHING was being passed to the template.
Has anyone else experienced this or can anyone confirm that when using an Inline XSLT Template no other functoids execute. If this is true, is there any way for me to do a DB lookup from the XSLT template?
-
May 22, 2008 at 3:14 PM #19721
The XSLT template does not supercede the other functoids in a map. All your other functoids will continue to operate.
There are a number of ways to use DB values in an XSLT Template.
You can have functoid that passes the value into the template as a parameter or you can call code from within your template.
A good debugging method is to validate your map and examine the resulting XSLT (The Biztalk mapper is really an XSLT compiler, it takes your links and functoids and compiles this into XSLT)
You can also create the entire map in an external XSLT file and attach this to the map. This is my preferred method. You can use the inbuilt XSLT debugger from VS2005 (gives you breakpoints and the ability to step through the XSL), you can call any code including internal scripts and external libraries using an extension xml file.
-
May 23, 2008 at 6:28 AM #19730
Hey Greg,
Questions:
1. When I Test a map from VS will it perform the DB Lookup?
2. How can I do a DB call from within a template?
3. What format should the Connection String parameter bein for the DB Lookup Functoid?
4. How do you debug XSLT? I’ve done it as a seperate project, but I found this very tedious and time consuming. Is there a way to directly debug XSLT from within my BizTalk Project?
-
May 26, 2008 at 1:42 PM #19749
Yes, the Biztalk, Test Map function will perform the DB Lookup.
You need to examine the resulting XSLT from the Validate Map function, you will be able to see how the DB Lookup is called, basically call embedded C# scripts. You should be able to replicate this in the template.
The connection string will look something like this:
Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=YourDb;Data Source=YourSQLInstanceRemember the host instance service account must have access to the database.
I tend to use XSLT for all maps that are more complicated than straight field to field mapping. Create an XSLT file and then specify this file in the map Custom XSL Path. You can then debug this XSLT using the standard VS2005 XSL debugger (with the XSL file open, check out the XML menu item).
The Biztalk Mapper compiler generates some less than desirable code. My all time favorite is the Logical Existence functoid which does this:
<xsl:if test=”userCSharp:LogicalExistence(boolean(ns0:element))”/>
public bool LogicalExistence(bool val)
{
return val;
}This can be replaced by the following XSLT:
<xsl:if test=”ns0:element”/>
-
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.