[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: How to 'execute' a table without manually converti

Subject: Re: How to 'execute' a table without manually converting it to a bunch of nested if-then-else statements?
From: "Liam R. E. Quin liam@xxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 20 Feb 2023 02:03:20 -0000
Re:  How to 'execute' a table without manually converti
On Sun, 2023-02-19 at 18:21 +0000, Roger L Costello costello@xxxxxxxxx
Alas, as you
> know, Microsoft Word tables cannot be embedded into XSLT programs.

Well, since these days they are encoded in XML in the Word files, they
actually can.

In practice nested maps or an xsl:choose or an element structure or
functions or named templates or a combination, whatever seems to fit in
best with the rest of the stylesheet probably.


> I remember Liam saying (paraphrasing): "Any program longer than 6
> lines has bugs."

I think i said that i had never seen a program longer than 6 lines that
didn't have a bug.

>  How do *you* translate tables into code? Do you have a way that is
> 100% guaranteed to faithfully/accurately encode the table?

For a large decision table, i'd indeed want some static representation
of it. The XPath fragments in your example suggest the use of maps
(which preserve node identity), or possibly a map with a function for
each row, so that the XPath expressions are contained in the body of
the function and evaluated on demand.

One way might look like this:

<xsl:variable name="WidthPrecisionTable" as="map(*)"
  select="
    map {
      '* *' : function($arg as node()) as item()* {
        $arg/following-sibling::argument[2]
      },
      '* nonps' : function($arg as node()) as item()* {
        $arg/following-sibling::argument[1]
      }
 . . .
    }
  "/>

liam

--
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

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.