Subject: Re: [xsl] xpath help? From: "David Birnbaum djbpitt@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Wed, 12 Feb 2025 23:22:55 -0000 |
Try: /descendant::a[contains(@filepath, 'preface.html')][1]/@newid On Wed, Feb 12, 2025 at 5:53b/PM 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> > <div class="coverpage"> > <span class="publicationdate">February 12, 2025</span> > </div> > <div class="copyrightstatement"/> > <div class="toc"> > <ul class="nav-list"> > <li class="nav-item is-current-page" > data-depth="1"> > <a newid="d3e90" class="nav-link" > filepath="preface.html" > href="#d3e90" > entry-type="file">Evaluation</a> > </li> > <li class="nav-item" data-depth="1"> > <a newid="d3e139" class="nav-link" > > filepath="${release.notes.base}/preface.html" href="#d3e139" > entry-type="URL">Release notes</a> > </li> > <li class="nav-item" data-depth="1"> > <a newid="d3e237" class="nav-link" > > filepath="../deployment-planning-guide/preface.html" > href="#d3e237" > entry-type="file">Deployment planning</a> > </li> > <li class="nav-item" data-depth="2"> > <a newid="d3e247" class="nav-link" > > filepath="../deployment-planning-guide/understanding-iam.html" > href="#d3e247" > entry-type="file">Identity and Access > Management</a> > </li> > <li class="nav-item" data-depth="3"> > <a newid="d3e255" class="nav-link" > > filepath="../deployment-planning-guide/not-just-sso.html" > href="#d3e255" > entry-type="file">More than just single > sign-on</a> > </li> > </ul> > </div> > </nav>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] xpath help?, Michael Kay michaelk | Thread | [xsl] Advantages and disadvantages , Roger L Costello cos |
Re: [xsl] xpath help?, Michael Kay michaelk | Date | Re: [xsl] xpath help?, dvint dvint@xxxxxxxx |
Month |