locked
XSLT for conditional sibling nodes RRS feed

  • Question

  • Hi,

    I need to write a XSLT to get the value of the nearest dictionary value to a give node. For example, my structure could be as below

    <rootnode>
     <rootcontainer>
      <dictionary>
       <key1> value <key1>
      <dictionary>
      <pages>
       <page1>
        <!--xslt goes here-->
       </page1>
       
      </pages>
     </rootcontainer>
     <dictionary>
      <key1>
       independent value
      </key1>
      <key2>
       value 2
      </key2>
     </dictionary>
    </rootnode>


    I want to create variables $key1 and $key2 inside Page 1. The value of $key1 will be value and the value of key2 will be value 2. In case rootcontainer\dictionary\key1 doesnt exist, the value of $key1 will be independent value. I hope this makes sense. 

     

    Thanks in advane for helping me out.

    Thursday, January 27, 2011 6:43 PM

Answers

  • Sorry, so far I don't understand what you want to achieve. XSLT is not put into the middle of some XML document so I am not sure why your comment says "xslt goes here".

    If the posted sample is your XML input and you need help to transform it with XSLT then please post the corresponding output sample you want to create with XSLT.


    MVP Data Platform Development My blog
    Friday, January 28, 2011 11:41 AM