How do you get all your ancestors with the atribut?



  • How with xslt and xpath from, for example, a xml file:

    <a>
        <b1>
            <c1 value="1" />
        </b1>
    
    &lt;b2&gt;
        &lt;c2 value="2" /&gt;
    &lt;/b2&gt;
    
    &lt;/b3&gt;
        &lt;c3&gt;
            &lt;d value="3" /&gt;
        &lt;/c3&gt;
    &lt;/b3&gt;
    

    </a>

    To obtain full paths to the attribut value, i.e. the list of all ancestors.

    a/b1/c1/@value

    a/b2/c2/@value

    a/b3/c3/d/@value

    Attribution value and investment may be any



  • //*[@value]
    
    • // any root (any root)
    • * any teg (any tagName)
    • @value has attribute value

    The rest of the perverts are here-- https://sodocumentation.net/xpath/topic/3096/find-nodes-that-have-a-specific-attribute



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2