cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT Mapping

Former Member
0 Kudos

Hi

In XSL mapping how do i check the existince of a field in the source node

For example we have 'exists' function in Message Mapping. How can we acheive this in XSL mapping

-keerthi

Accepted Solutions (1)

Accepted Solutions (1)

udo_martens
Active Contributor
0 Kudos

Hi Keerthi,

you can achieve that indirect:

<xsl:if select="string-length(//mySourceField) &gt; 0">
   <do>something</do>
</xsl:if>

Regards,

Udo

Former Member
0 Kudos

Hi

I have a node like this

<Document_Numer> </Document_Number> to be filled buy XSL mapping

The pesedo code is

if Substring("some string value",5,2) is empty, then the <Document_Numbe> should be Substring("some string value",5,3)

if Substring("some string value",5,2) is not empty then <Document_Numbe> should be Substring("some string value",5,2)

How do i acheive this xslt. can anyone help me with the XSL code for this please

-Keerthi

Former Member
0 Kudos

Hi Keerthi,

Perhaps some variation of the following will help:


  <Document_Number>
    <xsl:choose>
      <xsl:when test="normalize-space(substring(myNode, 5, 2)) = ''">
        <xsl:value-of select="substring(myNode, 5, 3)"/>
      </xsl:when>
      <xsl:otherwise>
        <xsl:value-of select="substring(myNode, 5, 2)"/>
      </xsl:otherwise>
    </xsl:choose>
  </Document_Number>

-Russ

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

You can also try this:

Create " B" at the target if "A" field is there at the source:

<xsl:if test="A">

<B> </B>

</xsl:if>

Thanks

Amit

MichalKrawczyk
Active Contributor
0 Kudos

Hi,

maybe the same function ?

http://www.xsltfunctions.com/xsl/fn_exists.html

Regards,

Michal Krawczyk