Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Maps: custom xsl code- access values from an xml document using document()
- This topic has 1 reply, 1 voice, and was last updated 9 years, 6 months ago by
community-content.
-
AuthorPosts
-
-
November 26, 2006 at 9:49 PM #16534
Hi,
I have created a map using xslt (custom xsl). I would need to access data from another file apart from the input message(Trying using either registry access or access an XML file using document function).The data may not change for a short period, however gradual changes in a long course can be expected. In my application I am not using orchestrations.
Trouble:
1.using Document function (xslt)
I am trying to use the document function to parse through a xml and get node values for my xsl stylesheet.
E.g. sample.xml – has the values to be parsed and placed in the map.
****************<? xml version="1.0" encoding="utf-8" ?>
<RootNode>
<Node1>value1</Node1>
<Node2>value2</Node2>
</RootNode>
********
And in my xsl stylesheet I try to get the values
******<xsl:variable name="var1" select="document('sample.xml')/RootNode/Node1"/>
…
<OutputNode><xsl:value-of select="$var1"/></OutputNode>******
But my output that I am getting: <OutputNode/> – means the nodes arent being accessed.
For the document function i even tried giving the path name: i.e. document('<Drive>:\Folder\sample.xml') – but I am not getting any output.I am not able to figure out where I am going wrong, If I need to place a file in some particular path .Or do I need to set some properties in the Map. Please do let me know.
2.Using registry keys also its possible. I would like to know which of the above method is more efficient.
3.In the both the methods I would have to look into the xml file/registry key for every input message (and I get a large no of messages). So the efficiency would surely reduce.
Can I do a work around. That just look into the file once I load(or reload the application) and stores the value in the xsl code, so as to reduce the turn around time or this is the only way.
Thanks in advance.
-
November 27, 2006 at 1:18 AM #16535
Your main problem will be performance for both the registry and Xml document option. Each will require a disk access to retrieve the require information for each map.
Two suggestions:
1. Create a .Net class that can be called from the map. Use the Custom Extension Xml method to access your class from the map – see previous post which describes how to access the Registry class in the mscorlib (Microsoft.Win32) assembly. In this class use a static array or hashtable to cache the values in memory and provide a static method to return a value.2. Create a custom pipeline component that will cache values as above. The pipeline could promote values into the message context. On the send port the XmlAssembler would demote these properties back into the message.
If you need to map the document to change the schema then option 1 would be better – you have to perform the map anyway.
If the map is only used to change node values then option 2 may be faster.
Both of these methods would cache values in a static object that would exist while the assembly is loaded. To reload the cache you will have to restart the Biztalk host application.
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.