Subject: Re: [xsl] XML to text - converting DITA to asciidoc From: "dvint dvint@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: Sat, 9 Dec 2023 19:50:44 -0000 |
Thanks, the <xml:strip-space> did the trickSent from my Verizon, Samsung Galaxy smartphone -------- Original message --------From: "Martin Honnen martin.honnen@xxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> Date: 12/9/23 10:45 AM (GMT-08:00) To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: Re: [xsl] XML to text - converting DITA to asciidoc On 09/12/2023 19:04, dvint@xxxxxxxxx wrote:> I'm trying to process complex inline DITA content to text and at the> same time both process inline markup and strip excess whitespace that> comes from having the content in a pretty printed format.>> I suppose a quick fix might be to go through and un=pretty the XML in> a pre-pass. Anyone got something that does that?>> Currently, I'm trying to process these files as they are in XML and> make nice text blocks in the converted content. I know that> normalize-space() will strip the space from text, but it doesn't allow> processing of the markup at the same time.>> So if I have a call like>> <xsl:apply-templates/>>> I get this when processing an <li>>> ======> * link:lnu1689300505181.dita[Step> B B B B B B B B B B B B B B B B B B B 3]>> * link:txr1689300527868.dita[Step> B B B B B B B B B B B B B B B B B B B B B B B 4]>> * Complete!>>>>>> * link:fkt1688690571816.dita[Show me the primary landing> B B B B B B B B B B B B B B B B B B B B B B B B B B B page]>> * link:fto1689306405929.dita[Show me> B B B B B B B B B B B B B B B B B B B B B B B B B B B tiles without descriptions]>>>>>>>> * link:https://example.com[Sample app]>>>>> *> B B B B B B B B B B B B B B B B B B B link:https://example.com[Security Key]>> ======>> If I change that call to>> <xsl:apply-templates select="normalize-space(.)"/>>> I get clean text, but now I'm missing the processing of the inline> elements like these <xref>s>>Either strip space from the input during input tree building with e.g. B <xsl:strip-space elements="*"/>or, if you want to normalize space in text nodes, use e.g. B <xsl:template match="text()"> B B B <xsl:value-of select="normalize-space()"/> B </xsl:template>That way your xsl:apply-templates will process any inline elements withmatching templates and the encountered text nodes with above template.
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] XML to text - converting , Martin Honnen martin | Thread | [xsl] XSLT 3.0 references?, Mark Giffin m1879@xx |
Re: [xsl] XML to text - converting , Martin Honnen martin | Date | [xsl] XSLT 3.0 references?, Mark Giffin m1879@xx |
Month |