Subject: Re: [xsl] XSL stylesheet issue (newbie) From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Thu, 17 Oct 2024 17:52:07 -0000 |
On 17/10/2024 19:41, Martin Honnen martin.honnen@xxxxxx wrote: >> The stylesheet below is supposed to add a unique 'id' attribute named 'tocref001', 'tocref002' etc. to all <h2>, <h3> and <p class="rn_heading"> elements which are descendants of an element with an 'id' attribute named 'rn_release_notes'. The script runs without any errors, but does not add any IDs. > > > The sample input has e.g. > > B html xmlns="http://www.w3.org/1999/xhtml" > > meaning it has elements in the XHTML namespace, if you use an XSLT 2 > or 3 processor like Saxon Java, SaxonJS, SaxonC or Saxon.NET you can add > > B xpath-default-namespace="http://www.w3.org/1999/xhtml" > > on your xsl:stylesheet element in the XSLT code and your match > >> <!-- Adding id=toc001 attributes to headings to create hyperlink targets for the TOC --> >> <xsl:template match="*[@id='rn_release_notes']//h2 | *[@id='rn_release_notes']//h3 | *[@id='rn_release_notes']//p[@class='rn_heading']"> >> > will match XHTML elements. > With more recent version of Saxon (11, 12 at least, I think) you could also use your original stylesheet code but add the command line option B -ns:##html5 for execution The value|##html5|declares that an unprefixed element name will match either a name in the XHTML namespace, or a name in no namespace.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XSL stylesheet issue (new, Martin Honnen martin | Thread | [xsl] XSL stylesheet issue (newbie), Frank Dissinger fran |
Re: [xsl] XSL stylesheet issue (new, Martin Honnen martin | Date | Re: [xsl] XSL stylesheet issue (new, Dave Pawson dave.paw |
Month |