Subject: Re: [xsl] Algorithm for setting a variable number of attributes From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Tue, 2 Aug 2022 21:35:22 -0000 |
On 02.08.2022 22:11, Steven D. Majewski steve.majewski@xxxxxxxxx wrote: > > Not a direct answer to this question, but I was just thinking, while > going thru the Invisible XML https://invisiblexml.org intro and > tutorial that it would sure be handy if the parser was a callable > function from XSLT or XQuery b writing a grammar for things like human > written variations of dates would be nicer to deal with than regex > code. There are XQuery and XSLT implementations, so maybe itbs doable. Right, online sample using Saxon HE Java 11 and Norman's Coffeepot is at this link <https://martin-honnen.github.io/xml-workbench/?code=%3C%3Fxml+version%3D%221 .0%22+encoding%3D%22utf-8%22%3F%3E%0A%3Cxsl%3Astylesheet+xmlns%3Axsl%3D%22htt p%3A%2F%2Fwww.w3.org%2F1999%2FXSL%2FTransform%22%0A++version%3D%223.0%22%0A++ xmlns%3Axs%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%22%0A++xmlns%3Acs% 3D%22http%3A%2F%2Fnineml.com%2Fns%2Fcoffeesacks%22%0A++exclude-result-prefixe s%3D%22%23all%22%0A++expand-text%3D%22yes%22%3E%0A++%0A++%3Cxsl%3Atemplate+ma tch%3D%22subtask%22%3E%0A++++%3Cxsl%3Acopy%3E%0A++++++%3Cxsl%3Aapply-template s+select%3D%22cs%3Aparse-string%28cs%3Agrammar-string%28%24grammar%29%2C+.%29 %2Fnode%28%29%22+mode%3D%22attributes%22%2F%3E%0A++++%3C%2Fxsl%3Acopy%3E%0A++ %3C%2Fxsl%3Atemplate%3E%0A++%0A++%3Cxsl%3Aoutput+method%3D%22xml%22+indent%3D %22yes%22%2F%3E%0A%0A++%3Cxsl%3Amode+on-no-match%3D%22shallow-copy%22%2F%3E%0 A++%0A++%3Cxsl%3Amode+name%3D%22attributes%22+on-no-match%3D%22shallow-skip%2 2%2F%3E%0A++%0A++%3Cxsl%3Atemplate+match%3D%22result%2F*%22+mode%3D%22attribu tes%22%3E%0A++++%3Cxsl%3Aattribute+name%3D%22%7Blocal-name%28%29%7D%22+select %3D%22.%22%2F%3E%0A++%3C%2Fxsl%3Atemplate%3E%0A%0A++%3Cxsl%3Atemplate+match%3 D%22%2F%22+name%3D%22xsl%3Ainitial-template%22%3E%0A++++%3Cxsl%3Anext-match%2 F%3E%0A++++%3Cxsl%3Acomment%3ERun+with+%7Bsystem-property%28%27xsl%3Aproduct- name%27%29%7D+%7Bsystem-property%28%27xsl%3Aproduct-version%27%29%7D+%7Bsyste m-property%28%27Q%7Bhttp%3A%2F%2Fsaxon.sf.net%2F%7Dplatform%27%29%7D%3C%2Fxsl %3Acomment%3E%0A++%3C%2Fxsl%3Atemplate%3E%0A%0A++%3Cxsl%3Aparam+name%3D%22gra mmar%22+as%3D%22xs%3Astring%22+expand-text%3D%22no%22%3Eresult+%3D+-%5B%27A%2 7-%27Z%27%5D%2B%2C+-space%2C+chapnbr%2C+-delimiter%2C+sectnbr%2C+-delimiter%2 C+subnbr%2C+-delimiter%2C+func%2C+-delimiter%2C+seq%2C+-space%2C+-delimiter%2 C+-space%2C+%27%28%27%2C+revdate%2C+%27%29%27.%0Adelimiter+%3D+%27-%27.%0Aspa ce+%3D+%27+%27.%0Achapnbr+%3D+%5B%270%27-%279%27%5D%2C%5B%270%27-%279%27%5D.% 0Asectnbr+%3D+%5B%270%27-%279%27%5D%2C%5B%270%27-%279%27%5D.%0Asubnbr+%3D+%5B %270%27-%279%27%5D%2C%5B%270%27-%279%27%5D.%0Afunc+%3D+%5B%270%27-%279%27%5D% 2C%5B%270%27-%279%27%5D%2C%5B%270%27-%279%27%5D.%0Aseq+%3D+%5B%270%27-%279%27 %5D%2C%5B%270%27-%279%27%5D%2C%5B%270%27-%279%27%5D.%0Arevdate+%3D+%5B%270%27 -%279%27%5D%2C%5B%270%27-%279%27%5D%2C%5B%270%27-%279%27%5D%2C%5B%270%27-%279 %27%5D%2C%5B%270%27-%279%27%5D%2C%5B%270%27-%279%27%5D%2C%5B%270%27-%279%27%5 D%2C%5B%270%27-%279%27%5D.%3C%2Fxsl%3Aparam%3E%0A%0A%3C%2Fxsl%3Astylesheet%3E %0A&input=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%0A%3Croo t%3E%0A++%3Csubtask%3ESUBTASK+25-31-04-714-080+-+%2820130315%29%3C%2Fsubtask% 3E%0A%3C%2Froot%3E%0A&code-type=XSLT&input-type=XML>.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Algorithm for setting a v, John Lumley john@xxx | Thread | Re: [xsl] Algorithm for setting a v, Martin Honnen martin |
Re: [xsl] Algorithm for setting a v, John Lumley john@xxx | Date | Re: [xsl] Algorithm for setting a v, Martin Honnen martin |
Month |