BizTalk Server Tools - Modifying XSLT Generation for Custom Functoid during Map Compilation

This is Interesting: Free IT Magazines  
Home > Archive > BizTalk Server Tools > June 2006 > Modifying XSLT Generation for Custom Functoid during Map Compilation





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Modifying XSLT Generation for Custom Functoid during Map Compilation
David Carroll

2005-07-13, 6:00 pm

Anyone aware of any .NET Method Attributes or even unsupported
functoid/mapper interfaces I could implement in my custom functoids to
customize the XSLT generated from my functoid when compiling a map?
(Whew, that was a mouthful...) This hook, sink, or whatever you want to
call it would provide the source and destination XPath values, as well
as the parameters applied to the functoid so I could work with the same
resources as the current map compiler/XSLT Generator. My guess is this
would work similarly to pipeline components where a reference to a
stream is passed in with a context object providing all the resources I
mentioned above. Then a new modified stream would be returned to
continue generating the XSLT for the rest of the map.

What I'm trying to do is eliminate the creation of empty attributes or
elements during transformations in the destination message when the
source attribute did not exist at all. This behavior only happens when
connecting a Source Attribute to a Destination Attribute with some
functoid in between. I've been able to avoid this behavior by using a
Value Mapping Functoid or by using a Call-Template XSLT Scripting
Functoid where I can evaluate for certain conditions before writing out
the XSLT. The latter isn't much fun because you must hard code the
XSLT to match the Destination Schema.

The problem with using Value Mapping Functoid is it can clutter up a
rather large map using a lot of custom functoids. Let's say the
custom functoid is used to format dates supplied by a source document
during a map transformation. However, if the source element does not
exist, the destination element is created as an empty node. This
happens because the XSLT generated by the map takes the following
approach when using functoids:

(psuedo code below)
1.) Populate <xsl:variable name="v1" select="functoid call"/>
2.) Assign value of $v1 to element.
<xsl:element name="destinationName">
<xsl:value-of select="$v1"/>
</xsl:element>

As you can see, the XSLT for generating the ELEMENT tag is NOT
dependent on whether or not the functoid call returned a value.

The Value Mapping Functoid wraps the <xsl:element> XSLT within an XSLT
conditional: (psuedo code below)
<xsl:if test="$paramValue1=true">
<xsl:element name="destinationName">
<xsl:value-of select="$v1"/>
</xsl:element>
</xsl:if>

Here you can see the XSLT for generating the ELEMENT tag IS DEPENDENT
on some parameter values being true. If not for the Value Mapping
Functoid behavior, I wouldn't even think to inquire on extending the
map compiler.

Any help would be appreciated.

- David Carroll

Bob Duckworth

2006-06-06, 1:19 pm

Hi David

I know it is a long time ago, but did you ever get an answer to this? I saw
that you posted this question on several sites, but have not seen a response
to any of them...

I have a similar requirement, in that I am building my own Mass Copy
functoids (to handle processes with <Any> elements) using inline XSLT Call
Templates, and I need to embed the name of the target link node into the
XSLT script. Therefore I need to somehow get a hook back to the calling map,
to the specific instance of the functoid, and then to the XPATH in the
Target Links property at compile time... How do you do this (and it must be
possible because the Mass Copy functoid does it!)?

Any help would be much appreciated!

Best regards

Bob
Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com