XSLT Conditional creation of destination Node



I'm trying to write an XSLT to convert an XML document from one schema
to
another.

The destination XML schema has an optional State element. The element
can be
left out, but if it's present it must have a two character code. The
source XML has
a required element of type string that be left blank. My problem is,
if the source node is present but blank, I want to NOT create the
destination Date node. If the source node is populated
then I want the destination node create and populated.

How do I do this?

Currently, I seem to always get the destination node and if the source
was
blank, the destination is comming up blank and causing a schema
validation
error.

In case you can't tell... I'm a complete NEWBIE to XSTL.

I'm currently using Altova MapForce 2006 to do the development.

Someone in another news group recommend the following:
---------------------------------------------------------------------------------------------------
<xsl:template match="source-element-name[text()]">
<result-element-name>
<xsl:value-of select="." />
</result-element-name>
</xsl:template>

<xsl:template match="source-element-name(not(text())]" />
---------------------------------------------------------------------------------------------------


But being so new to both XSLT and Altova's MapForce, I have no idea how
I would include such code in my Mapforce mapping.

Any help would be greatly appreciated.

.



Relevant Pages

  • Re: Simple mapping question
    ... Yeap created the XSD for the source and destination, ... The destination schema in your case should be a flat file schema. ... There isn't an XML schema ... ...
    (microsoft.public.biztalk.general)
  • Re: Maps
    ... map to particular standard. ... destination that would have to be populated even if the source ... nodes in destination schema and create the non existant on, ... I use the functoids to check for null, or empty strings before setting the ...
    (microsoft.public.biztalk.general)
  • Re: Mapping - one element in to many
    ... How would I define this in my schema? ... Element in destination schema, ... create the Sequence group and include all those 7 Element in it. ... Leonid Ganeline ...
    (microsoft.public.biztalk.general)
  • Date Mapping Question
    ... The source schema has an element ... that is a datetime type and my destination is a string element. ... I was hoping there would be a date formatting functoid available, ...
    (microsoft.public.biztalk.general)
  • Re: How to enrich a message?
    ... If you wish to insert Xml into the destination that did not originate in the ... public string GetXml ... to use the scripting functoid to call an external assembly that looks ...
    (microsoft.public.biztalk.general)

Loading