Subject: Re: [xsl] I love programs that output programs From: "dvint dvint@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Sun, 19 Jan 2025 21:11:43 -0000 |
Maybe parameters would do it by refactoring. I had a situation where I was processing content in multiple ways and I started by assigning a mode initially. For instance handling links in different ways for instance based upon the current mode.Why were multiple modes allowed on templates then? Sure things might always be handled with switch/choose blocks but modes seem simpler. I don't know if multiple modes were an addition or not but I used them for the first time just recently - that is on one template. In the past I duplicated the template.Modes seem more in line with xslt than a choose. Will the use of multiple modes in templates be removed then? Seems like it should be consistent no matter how they are managed.If this mode template is used, will it require all templates using modes to be within a mode element?..danSent from my Verizon, Samsung Galaxy smartphone -------- Original message --------From: "Michael Kay mike@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: 1/19/25 12:43 PM (GMT-08:00) To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] I love programs that output programs Recently I've started applying multiple modes to one template. This has simplified my stylesheets where I have several modes going on.B Will that be supported with this new mode element?B No.I would be interested in your use case for having a template rule in multiple modes. It's something I have very rarely seen a need for. I suspect that where you are using this, I would probably be using tunnel parameters.Michael KaySaxonicaThis new element will make it easier to deal with stylesheets with an editor like oxygen where you can collapse content. Currently I try and group templates with modes together and maybe a start and end comment but that doesn't help with minimizing content...danSent from my Verizon, Samsung Galaxy smartphone-------- Original message --------From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: 1/19/25 11:05 AM (GMT-08:00) To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] I love programs that output programs On Sun, 2025-01-19 at 11:16 +0000, Dave Pawson dave.pawson@xxxxxxxxxxxxxx:> Modes:> B Now 'enclosing modes'> Am I the only one thinking xslt4 is miles away (and of less use due> complexity)B from XSLT?This change is actually a simplification.You can now write<xsl:mode name="xref-insert-titles" on-no-match="shallow-copy">B B <xsl:template match="xref" ...>B B B B . . .B B </xsl:template>B B <xsl:template match="qv" ...>B B B . . .B B </xsl:template></xsl:mode>and know there are no other templates with that mode,and also know (as with XSLT 3) that the identity templateis built in to the mode for nodes that arenbt explicitlymatched.When using modes to simulate multiple transformations in one XSLTexecution, itbs common to see lots of templates scattered about thathave a mode="...." attribute, so this makes it easier to understand andmaintain stylesheets.So this can help the fuzzy space between single transformation and XSLTthat calls transform() and XSLT that creates XSLT on the fly for somelater XSLT process.Usage is optional, you can still scatter your templates instead ofputting them in a mode wrapper.I've wanted this since XSLT 1 days :)And, thank you Mike for confirming that itbs enforced.B The specs arein flux and the meetings are at a difficult time for me.-- Liam Quin,B https://www.delightfulcomputing.com/Available for XML/Document/Information Architecture/XSLT/XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.Barefoot Web-slave, antique illustrations: B http://www.fromoldbooks.org XSL-List info and archive EasyUnsubscribe (by email) XSL-List info and archive EasyUnsubscribe (by email)
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] I love programs that outp, Michael Kay mike@xxx | Thread | Re: [xsl] I love programs that outp, Graydon graydon@xxxx |
Re: [xsl] I love programs that outp, Michael Kay mike@xxx | Date | Re: [xsl] I love programs that outp, Graydon graydon@xxxx |
Month |