Jan 232015

I am sure I am the last to figure this out, so pardon me for my late entry to the game of XSL goodness.

A few years ago, I discovered the power of XSL, and now I never use any of the out of the box functiods, in fact, I am hard pressed to try to remember the last time I even used inline C# in my maps.

So here is how I have ALWAYS coded inline XSLT:

I need to create an output node


So, what I have always done is created the XSL like this:

<xsl:value-of select="count(/s1:Batch/s0:Form)" />

Which should work. However, when I either Validate the map or compile it, I get the following error:

MakeMessages.btm: error btm1023: Exception Caught: ‘ns2’ is an undeclared prefix. Line 1, position 2

So then I open up the map and go find the ns2 definition up at the top of the generated xsl


Copy the namespace down into the script like this:

<ns2:P_BATCH_ITEM_CNT xmlns:ns2="http://Microsoft.LobServices.OracleDB/2007/03/BIZTALK/Procedure">
<xsl:value-of select="count(/s1:Batch/s0:Form)" />

However, there is an ‘easier’ way to do this:

Use the xsl:element command, this way you don’t have to ‘care’ about declaring the namespace in all of your custom XSL scripts

<xsl:element name="ns2:P_BATCH_ITEM_CNT">
<xsl:value-of select="count(/s1:Batch/s0:Form)" />

Sorry, the comment form is closed at this time.