Subject: RE: [xsl] Modes (was RE: [xsl] Re: Keys, IDs lookup tables.) From: "Echlin, Robert" <Robert.Echlin@xxxxxxxxxxxxx> Date: Tue, 12 Jun 2012 15:34:21 +0000 |
Hi Michele, I have a case where I am migrating code from one format to another. Target format is DITA. Where the <table> elements have a <title>, we output a DITA <table>. If no <title>, we output a DITA <simpletable>. I chose to handle this by processing in either of two modes called "table" and "simpletable". The rows in the two cases are either <row> in table or <strow> in simpletable. Similarly, the names are <entry> and <stentry> for the table cells. The same "elements" are processed in more than one way. This is similar to processing the same "nodes" in more than one way as Ihe describes, but is not the same case. I am sure there are other valid cases for using "mode", however, as Ihe says, you don't want to use "modes" unless you need to, as they add one more layer to your code that the next user will need to understand. I have chosen to aid the reader in a simple way: - all uses of those two modes occur within 68 lines of code delimited with: <!-- START Tables --> <!-- END Tables --> Rob -----Original Message----- From: Ihe Onwuka [mailto:ihe.onwuka@xxxxxxxxxxxxxx] Sent: Monday, June 11, 2012 2:12 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] Modes (was RE: [xsl] Re: Keys, IDs lookup tables.) On Mon, Jun 11, 2012 at 5:54 PM, Michele R Combs <mrrothen@xxxxxxx> wrote: > Thanks. I should have been clearer in my request. I understand the concept of modes (what they are for) but have been having difficulty putting them into execution, and/or untangling them in pre-existing code. A technical explanation with examples is more what I'm looking for. > I have seen modes used to disambiguate template rules where priorities would have done the job, so the appearance of modes in pre-existing code may be gratuitous. My personal preference is to restrict the usage of modes to the use case where they are necessary, that way the appearance of modes in code highlights that the nodes in question are being processed by more than one template rule and their absence signals they are not. As Ken usefully pointed out this assumes push style processing. I find such disciplines useful, it saves you from having to read the code to find out the same thing.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Modes (was RE: [xsl] Re: , Ihe Onwuka | Thread | [xsl] RE: Trying to use fo:page-num, Underwood Michelle |
[xsl] Call java function to do back, Ming Yu | Date | RE: [xsl] Call java function to do , Echlin, Robert |
Month |