Re: [xsl] xpath help?

Subject: Re: [xsl] xpath help?
From: "dvint dvint@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 13 Feb 2025 00:28:37 -0000
Thanks, I don't think I've ever seen an XPath example with parents before.
I've certainly never used them. This did fix the problem...thanks..danSent
from my Verizon, Samsung Galaxy smartphone
-------- Original message --------From: "David Carlisle
d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date:
2/12/25  2:58 PM  (GMT-08:00) To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re:
[xsl] xpath help? B you are selecting all elements that are the first child of
their parentuse

(//a[contains(@filepath, 'preface.html')])[1]/@newid
or/descendant::a[contains(@filepath, 'preface.html')][1]/@newid DavidOn Wed,
12 Feb 2025 at 22:53, dvint@xxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:I have this xpath that returns
more than one result



//a[contains(@filepath, 'preface.html')]/@newid



I thought adding [1] to it like this would get me the first entry, but

the result doesn't change



//a[contains(@filepath, 'preface.html')][1]/@newid



Here is an example of the file I'm processing





<nav>

B  B  B  B  <div class="coverpage">

B  B  B  B  B  B  B  B  <span class="publicationdate">February 12,
2025</span>

B  B  B  B  </div>

B  B  B  B  <div class="copyrightstatement"/>

B  B  B  B  <div class="toc">

B  B  B  B  B  B  B  B  <ul class="nav-list">

B  B  B  B  B  B  B  B  B  B  B  B  <li class="nav-item is-current-page"
data-depth="1">

B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  <a newid="d3e90"
class="nav-link" filepath="preface.html"

B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  href="#d3e90"
entry-type="file">Evaluation</a>

B  B  B  B  B  B  B  B  B  B  B  B  </li>

B  B  B  B  B  B  B  B  B  B  B  B  <li class="nav-item" data-depth="1">

B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  <a newid="d3e139"
class="nav-link"

B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B 
filepath="${release.notes.base}/preface.html" href="#d3e139"

B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B 
entry-type="URL">Release notes</a>

B  B  B  B  B  B  B  B  B  B  B  B  </li>

B  B  B  B  B  B  B  B  B  B  B  B  <li class="nav-item" data-depth="1">

B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  <a newid="d3e237"
class="nav-link"

B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B 
filepath="../deployment-planning-guide/preface.html"

B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  href="#d3e237"
entry-type="file">Deployment planning</a>

B  B  B  B  B  B  B  B  B  B  B  B  </li>

B  B  B  B  B  B  B  B  B  B  B  B  <li class="nav-item" data-depth="2">

B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  <a newid="d3e247"
class="nav-link"

B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B 
filepath="../deployment-planning-guide/understanding-iam.html"

B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  href="#d3e247"
entry-type="file">Identity and Access

B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  Management</a>

B  B  B  B  B  B  B  B  B  B  B  B  </li>

B  B  B  B  B  B  B  B  B  B  B  B  <li class="nav-item" data-depth="3">

B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  <a newid="d3e255"
class="nav-link"

B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B 
filepath="../deployment-planning-guide/not-just-sso.html"

B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  href="#d3e255"
entry-type="file">More than just single

B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  B  sign-on</a>

B  B  B  B  B  B  B  B  B  B  B  B  </li>

B  B  B  B  B  B  B  B  </ul>

B  B  B  B  </div>

</nav>










XSL-List info and archive

EasyUnsubscribe
(by email)

Current Thread