[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] XSL stylesheet issue (newbie)
Hi Martin, I have added the bxpath-default-namespaceb attribute and now the script indeed produces the expected result. Thank you very much for your great help! The XSL element looks like this now: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0" xpath-default-namespace="http://www.w3.org/1999/xhtml" > BTW: I had to change the XSL version from 1.0 to 2.0 in the XSL element, otherwise Oxygen would use Saxon 6.5.5 for validation, which does not support the xpath-default-namespace atttribute. Now it uses "Saxon-PE 12.3" and the validation error message disappears. I found out that I can also change this to bversion=3.0b. The script would still run without any problems and validation issues. Freundliche GrC<Ce | Best regards Frank Dissinger Documentation Manager .......................................... CGS ORIS GmbH Email <mailto:frank.dissinger@xxxxxxxxxxxx> frank.dissinger@xxxxxxxxxxxx | Web <http://www.cgs-oris.com/> www.cgs-oris.com Address Kettelerstrasse 24 | 63512 Hainburg | Germany Phone +49 6182 9626-0 | Fax +49 6182 9626-99 Commercial register Offenbach, HRB no. 21495 Managing directors Bernd RC<ckert, Christoph Thommessenb Von: Martin Honnen martin.honnen@xxxxxx <mailto:martin.honnen@xxxxxx> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx <mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> > Gesendet: Donnerstag, 17. Oktober 2024 19:52 An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx <mailto:xsl-list@xxxxxxxxxxxxxxxxxxxxxx> Betreff: Re: XSL stylesheet issue (newbie) On 17/10/2024 19:41, Martin Honnen <mailto:martin.honnen@xxxxxx> 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. html xmlns= <http://www.w3.org/1999/xhtml> "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 xpath-default-namespace= <http://www.w3.org/1999/xhtml> "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 -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. XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/3258649> (by email <> ) [demime 1.01d removed an attachment of type image/png which had a name of image002.png]
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|