Picco: Xpath

Beitrag lesen

beispiel:
 <head><title>Hello, XPath!</title>

<!-- import jQuery -->
  <script type="text/javascript" src="/js/jquery-latest.pack.js"></script>
  <!-- import JavaScript-XPath -->
  <script type="text/javascript" src="/js/javascript-xpath.js"></script>
  <!-- import XPath for jQuery -->
  <script type="text/javascript" src="/js/xpath4jquery.js"></script>

<!-- use XPath -->
  <script type="text/javascript">
// <![CDATA[
$(function() {

$('//ul')
    .xfind('li[1.]')
      .append('Shut up')
    .end()
    .xfind('li[2.]')
      .append('and')
    .end()
    .xfind('li[3.]')
      .append('commit')
    .end()
    .xfind('li[4.]')
      .append('some code')
    .end()

})
// ]]>
  </script>

</head>
 <body>
  <h1>Hello, DOM 3 XPath!</h1>
  <ul>
   <li>1. </li>
   <li>2. </li>
   <li>3. </li>
   <li>4. </li>
  </ul>
 </body>

meine:
  // <![CDATA[
$(function() {

$('#navi')
    .xfind('li[<a href="/workshop.html]')
      .append('class="schluss"')
    .end()

})
// ]]>
  </script>

was ich hab:
<li class="">
<a href="/workshop.html">Workshop </a>
</li>

was ich will:
<li class="">
<a href="/workshop.html" class="schluss" >Workshop </a>
</li>

thx im vorraus