Re: [xsl] Looking for a cleaner way of auditing table cell data than this

Subject: Re: [xsl] Looking for a cleaner way of auditing table cell data than this
From: "Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 30 Aug 2022 11:04:07 -0000
Hi Trevor,

If you are strictly disallowing inline content in all table cells, then
putting <td> into the "disallow-inline" list should be sufficient.

For us, I do not want to strictly disallow inline content in table cells, but
I would like to catch and fix the intermingling of inline and block content. I
have been thinking about rewriting the "disallow-inline" function to use
templates with function accessors, then use something like

<xsl:template match="entry" mode="disallow-inline">
  <xsl:value-of select="false()"/>
</xsl:template>

<xsl:template match="entry[...test for mix of inline and block children...]"
mode="disallow-inline">
  <xsl:value-of select="true()"/>
</xsl:template>

to process only table cells with a mix of block and inline content.

What's your timeframe for getting a solution?

Also, I forgot to include the following helper function in my original reply:

  <!-- returns true if text() node is whitespace -->
  <xsl:function name="mine:is-whitespace" as="xs:boolean">
    <xsl:param name="node" as="text()"/>
    <xsl:sequence select="normalize-space($node) = ''"/>
  </xsl:function>


  *   Chris


From: Trevor Nicholls trevor@xxxxxxxxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Monday, August 29, 2022 2:09 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Looking for a cleaner way of auditing table cell data than
this

Thanks Chris, that looks like something I can work with; I hadn't thought of
functions.

You say your stylesheet was intended to modify <li> elements; funnily enough
that was something I asked them to do to the schema earlier in the project and
now simple content list items are not allowed. But tables are a bigger ask,
apparently. I am sure I can use something adapted from your code to fix the
input before my other stylesheets have to work with it.

cheers
T

Current Thread