Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. XML / XSL
  4. Comparing two elements in XSLT

Comparing two elements in XSLT

Scheduled Pinned Locked Moved XML / XSL
xml
3 Posts 3 Posters 31 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member_14826232
    wrote on last edited by
    #1

    I have two elements in a XSLT

    "/glcim:lcim/glcim:applicant-details/glcim:applicant-reference"

    and

    "/glcim:lcim/glcim:applicant-details/glcim:applicant-reference_new"

    I want to compare the value of these two elements and if they differ in value
    i want to populate the value of glcim:applicant-reference_new into ApplicationId field

    can i get an XSLT code for it please

    Right now I have

    "RefId":"
            	 ",
    

    which populates the RefId with the value of /glcim:lcim/glcim:applicant-details/glcim:applicant-reference

    But I would like to populate RefId with "/glcim:lcim/glcim:applicant-details/glcim:applicant-reference_new"
    only if the values of glcim:applicant-reference_new differ from glcim:applicant-reference else Skip populating the Refid

    ANy XSLT code would be greatly appreciated

    Richard DeemingR 1 Reply Last reply
    0
    • M Member_14826232

      I have two elements in a XSLT

      "/glcim:lcim/glcim:applicant-details/glcim:applicant-reference"

      and

      "/glcim:lcim/glcim:applicant-details/glcim:applicant-reference_new"

      I want to compare the value of these two elements and if they differ in value
      i want to populate the value of glcim:applicant-reference_new into ApplicationId field

      can i get an XSLT code for it please

      Right now I have

      "RefId":"
              	 ",
      

      which populates the RefId with the value of /glcim:lcim/glcim:applicant-details/glcim:applicant-reference

      But I would like to populate RefId with "/glcim:lcim/glcim:applicant-details/glcim:applicant-reference_new"
      only if the values of glcim:applicant-reference_new differ from glcim:applicant-reference else Skip populating the Refid

      ANy XSLT code would be greatly appreciated

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      Try:

      <xsl:if test="/glcim:lcim/glcim:applicant-details/glcim:applicant-reference != /glcim:lcim/glcim:applicant-details/glcim:applicant-reference_new">
      xsl:text"RefId":"</xsl:text>
      <xsl:value-of select="/glcim:lcim/glcim:applicant-details/glcim:applicant-reference_new" />
      xsl:text",</xsl:text>
      </xsl:if>

      xsl:if Element | Microsoft Docs[^]


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      Y 1 Reply Last reply
      0
      • Richard DeemingR Richard Deeming

        Try:

        <xsl:if test="/glcim:lcim/glcim:applicant-details/glcim:applicant-reference != /glcim:lcim/glcim:applicant-details/glcim:applicant-reference_new">
        xsl:text"RefId":"</xsl:text>
        <xsl:value-of select="/glcim:lcim/glcim:applicant-details/glcim:applicant-reference_new" />
        xsl:text",</xsl:text>
        </xsl:if>

        xsl:if Element | Microsoft Docs[^]


        "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

        Y Offline
        Y Offline
        yamin ibrar
        wrote on last edited by
        #3

        But I would like to populate RefId with "/glcim:lcim/glcim:applicant-details/glcim:applicant-reference_new"

        https://et20slam.net/aa-vs-wf-live-score-super-smash-2020-21/

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups