cancel
Showing results for 
Search instead for 
Did you mean: 

XSLT formatting

Former Member
0 Kudos

Hi,

i need some help by adding an expression in a XSLT

this is what it is now

<sch:CustomFieldList>

<sch:CustomField>

<sch:Attribute>ERP_UOM</sch:Attribute>

<sch:Value>

<xsl:value-of select="IDOC/E1AFKOL/GMEIN"/>

</sch:Value>

</sch:CustomField>

</sch:CustomFieldList>

and this is what I want

when value of "IDOC/E1AFKOL/GMEIN" is KGM this value must then be changed in KG

Thanks in advance and Best regards,

Marieke de Lange

Accepted Solutions (0)

Answers (2)

Answers (2)

stefan_grube
Active Contributor
0 Kudos

 <sch:CustomFieldList>
   <sch:CustomField>
     <sch:Attribute>ERP_UOM</sch:Attribute>
         <xsl:choose>
            <xsl:when test="IDOC/E1AFKOL/GMEIN[text()="KGM]">
              <sch:Value><xsl:text>KG</xsl:text></sch:Value>
            </xsl:when>
            <xsl:otherwise> 
               <sch:Value>
                    <xsl:value-of select="IDOC/E1AFKOL/GMEIN"/>
               </sch:Value>
          </xsl:otherwise>
        </xsl:choose> 
      </sch:CustomField>
    </sch:CustomFieldList>
Former Member
0 Kudos

I am sorry,

when put this in ths XSLT I got errors.

Best regards

stefan_grube
Active Contributor
0 Kudos

This is only a sketch, not a tested XSLT.

stefan_grube
Active Contributor
0 Kudos

this

<xsl:when test="IDOC/E1AFKOL/GMEIN[text()="KGM]">

should be:

<xsl:when test="IDOC/E1AFKOL/GMEIN[text()="KGM"]>

Former Member
0 Kudos

Sorry, but this statement is also giving an error.

Best regards,

Marieke

former_member204873
Contributor
0 Kudos

You can try:

http://www.w3schools.com/xsl/xsl_choose.asp

<xsl:choose>

<xsl:when test="expression">

<xsl:value-of select="substring(IDOC/E1AFKOL/GMEIN, 1, 2)"/> </xsl:when>

<xsl:otherwise>

<xsl:value-of select="IDOC/E1AFKOL/GMEIN"/>

</xsl:otherwise>

</xsl:choose>

Former Member
0 Kudos

Hi, but my problem is what must be in the when statement to get KG in the field ERP_UOM

thanks