title: Find preceding-sibling of the parent element in xslt
body: <pre><code>         &lt;p&gt;
              &lt;p1&gt;c&lt;/p1&gt;
              &lt;a languageCode="en"&gt;a1&lt;/a&gt;
              &lt;a languageCode="de"&gt;a2&lt;/a&gt;
               &lt;ca&gt;
                  &lt;cc&gt;056&lt;/cc&gt;
                  &lt;cs&gt;BE-VAN&lt;/cs&gt;
                  &lt;cs&gt;BG-VLI&lt;/cs&gt;
                  &lt;cs&gt;BG-VLI&lt;/cs&gt;
              &lt;/ca&gt;
              &lt;ca&gt;
                  &lt;cc&gt;056&lt;/cc&gt;
                  &lt;cs&gt;BE-VAN&lt;/cs&gt;
                  &lt;cs&gt;BG-VLI&lt;/cs&gt;
                  &lt;cs&gt;BG-VLI&lt;/cs&gt;
              &lt;/ca&gt;
          &lt;/p&gt;
  </code></pre>
  
  <p>i tried this does not work:</p>
  
  <pre><code>&lt;xsl:for-each select="p/ca/*"&gt;
      &lt;xsl:if test="not(preceding-sibling::*[1]/name() = local-name())"&gt;
              &lt;precedingParent n="{preceding-sibling::*[1]/parent::*/name()}"&gt;&lt;/precedingParent&gt;
      &lt;/xsl:if&gt;
  &lt;/xsl:for-each&gt;
  </code></pre>
  
  <p>but expected
  output should be:</p>
  
  <pre><code>&lt;precedingParent n="a"&gt;&lt;/precedingParent&gt;
  </code></pre>
  
  <p>I am looping in ca and for instance in first occurence of cs
  If a want to find the preceding sibling of the parent for parent ca for element cs ? how do i do it?</p>