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: "Trevor Nicholls trevor@xxxxxxxxxxxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 30 Aug 2022 11:43:23 -0000
Hi Chris

 

I figured out the is-whitespace function but thanks for showing me yours!

 

Like you, I don't think I want to insist on table cells having no inline
content. There are far too many tables in this library which contain dozens
of single value cells and forcing them all into paragraphs just seems like
the wrong option. But I don't want "mixed" content either because - as I
just discovered this week - that appears to break the part of the
application which indexes the content (and may have insidious effects
elsewhere too).

 

So at this point I have adapted your functions to identify all the rogue
cells and wrap the loose "inline" content in paras, and I'm in the middle of
verifying that it has actually fixed the indexing issue. If it has then I'll
look at putting a better version of it into the production process.

 

If only XSD supported a "0 or 1 of (these), and 0 or 1 of (those), but not
both".

 

cheers

T

 

 

From: Chris Papademetrious christopher.papademetrious@xxxxxxxxxxxx
<xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> 
Sent: Tuesday, 30 August 2022 23:05
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Looking for a cleaner way of auditing table cell data
than this

 

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
<mailto:trevor@xxxxxxxxxxxxxxxxxx>  <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx
<mailto:xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> > 
Sent: Monday, August 29, 2022 2:09 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx <mailto: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

XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>  

 <http://lists.mulberrytech.com/unsub/xsl-list/1349719> EasyUnsubscribe (
<> by email) 

Current Thread