locked
Inline XSLT mapping RRS feed

  • Question

  • I have below structure in schema

    <Record>

    <Field1>  </Field1>

    <Field2>  </Field2>

    </Record>

    Previously I was mapping Field1 and Field2 one to one to destination schema. Later we got requirement to add xsi:type attribute to Record element. So I have used the inline XSLT to add attribute. Below is inline XSLT:

      <Record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
       <xsl:attribute name="xsi:Type">
        <xsl:value-of select="'ABC'" />
       </xsl:attribute>

      </Record>

    But issue I am facing is the Field1 and Field2 are not getting mapped. When I add the mapping for these two fields in inline XSLT then it is working.

    Is this mean that we can not use inline XSLT and mapping together or I am missing something?

    Wednesday, September 30, 2015 1:41 PM

Answers

  • You cannot use both XSLT and Links to generate output.

    In this case, a XSLT Call Template is probably you best option.  You Link the source field as a Parameter.

    However, it's quite unusual (meaning no one does it :) to add schema type to an instance document.  That's what the Schema is for.  Are you sure about this?

    Wednesday, September 30, 2015 2:28 PM
    Moderator

All replies

  • You cannot use both XSLT and Links to generate output.

    In this case, a XSLT Call Template is probably you best option.  You Link the source field as a Parameter.

    However, it's quite unusual (meaning no one does it :) to add schema type to an instance document.  That's what the Schema is for.  Are you sure about this?

    Wednesday, September 30, 2015 2:28 PM
    Moderator
  • thanx for your reply Johns.

    If it is possible by XSLT call templte , can you tell me the XSLT code for this?

    Wednesday, September 30, 2015 2:36 PM
  • Hi Rocky,

    Can you please provide us your input instance and expected output for that?


    Thanks, Girish R. Patil.

    Wednesday, September 30, 2015 4:34 PM