[prev in list] [next in list] [prev in thread] [next in thread]
List: xsl-list
Subject: Re: [xsl] XML to text - converting DITA to asciidoc
From: "dvint dvint () dvint ! com" <xsl-list-service () lists ! mulberrytech ! com>
Date: 2023-12-09 19:51:17
Message-ID: 20231209145043.f5b1451d () lists ! mulberrytech ! com
[Download RAW message or body]
Thanks, the <xml:strip-space> did the trickSent from my Verizon, Samsung Galaxy \
smartphone
-------- Original message --------From: "Martin Honnen martin.honnen@gmx.de" \
<xsl-list-service@lists.mulberrytech.com> Date: 12/9/23 10:45 AM (GMT-08:00) To: \
xsl-list@lists.mulberrytech.com Subject: Re: [xsl] XML to text - converting DITA to \
asciidoc On 09/12/2023 19:04, dvint@dvint.com 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> 3]>> * \
link:txr1689300527868.dita[Step> 4]>> \
* Complete!>>>>>> * link:fkt1688690571816.dita[Show me the primary landing> \
page]>> * link:fto1689306405929.dita[Show me> \
tiles without descriptions]>>>>>>>> * link:https://example.com[Sample app]>>>>> *> \
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. <xsl:strip-space \
elements="*"/>or, if you want to normalize space in text nodes, use e.g. \
<xsl:template match="text()"> <xsl:value-of select="normalize-space()"/> \
</xsl:template>That way your xsl:apply-templates will process any inline elements \
withmatching templates and the encountered text nodes with above \
template.
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/651070
or by email: xsl-list-unsub@lists.mulberrytech.com
--~--
[Attachment #3 (text/html)]
<html><head><meta http-equiv="Content-Type" content="text/html; \
charset=UTF-8"></head><body dir="auto"><div dir="auto">Thanks, the \
<xml:strip-space> did the trick</div><div dir="auto"><br></div><div \
dir="auto"><br></div><div dir="auto"><br></div><div id="composer_signature" \
dir="auto"><div style="font-size:12px;color:#575757" dir="auto">Sent from my Verizon, \
Samsung Galaxy smartphone</div></div><div dir="auto"><br></div><div><br></div><div \
align="left" dir="auto" style="font-size:100%;color:#000000"><div>-------- Original \
message --------</div><div>From: "Martin Honnen martin.honnen@gmx.de" \
<xsl-list-service@lists.mulberrytech.com> </div><div>Date: 12/9/23 10:45 AM \
(GMT-08:00) </div><div>To: xsl-list@lists.mulberrytech.com </div><div>Subject: Re: \
[xsl] XML to text - converting DITA to asciidoc </div><div><br></div></div><br>On \
09/12/2023 19:04, dvint@dvint.com wrote:<br>> I'm trying to process complex inline \
DITA content to text and at the<br>> same time both process inline markup and \
strip excess whitespace that<br>> comes from having the content in a pretty \
printed format.<br>><br>> I suppose a quick fix might be to go through and \
un=pretty the XML in<br>> a pre-pass. Anyone got something that does \
that?<br>><br>> Currently, I'm trying to process these files as they are in XML \
and<br>> make nice text blocks in the converted content. I know that<br>> \
normalize-space() will strip the space from text, but it doesn't allow<br>> \
processing of the markup at the same time.<br>><br>> So if I have a call \
like<br>><br>> <xsl:apply-templates/><br>><br>> I get this when \
processing an <li><br>><br>> ======<br>> * \
link:lnu1689300505181.dita[Step<br>> \
\
3]<br>><br>> * link:txr1689300527868.dita[Step<br>> \
\
4]<br>><br>> * Complete!<br>><br>><br>><br>><br>><br>> * \
link:fkt1688690571816.dita[Show me the primary landing<br>> \
\
page]<br>><br>> * link:fto1689306405929.dita[Show me<br>> \
\
tiles without descriptions]<br>><br>><br>><br>><br>><br>><br>><br>> \
* link:https://example.com[Sample app]<br>><br>><br>><br>><br>> \
*<br>> \
link:https://example.com[Security Key]<br>><br>> ======<br>><br>> If I \
change that call to<br>><br>> <xsl:apply-templates \
select="normalize-space(.)"/><br>><br>> I get clean text, but now I'm \
missing the processing of the inline<br>> elements like these \
<xref>s<br>><br>><br><br>Either strip space from the input during input \
tree building with e.g.<br><br> <xsl:strip-space \
elements="*"/><br><br>or, if you want to normalize space in text nodes, use \
e.g.<br><br> <xsl:template match="text()"><br><br> \
<xsl:value-of select="normalize-space()"/><br><br> \
</xsl:template><br><br><br>That way your xsl:apply-templates will process any \
inline elements with<br>matching templates and the encountered text nodes with above \
template.<br><br><br></body></html> <div><!-- begin bl.html.trailer -->
<div style="border-top:1px solid black; background-color: #dddddd;
color: #888888; font-size: smaller; padding: 5px; text-align: center;
font-family: arial,verdana,arial,sans-serif; margin-top:1em; clear:
both; margin: auto">
<a href="http://www.mulberrytech.com/xsl/xsl-list">
XSL-List info and archive</a>
<div style="text-align:center;">
<a style="color: blue;"
href="http://lists.mulberrytech.com/unsub/xsl-list/651070"
> EasyUnsubscribe</a>
(<a style="color: blue;"
href="mailto:xsl-list-unsub@lists.mulberrytech.com?subject=remove"
> by email</a>)
</div>
</div>
<!-- end bl.html.trailer --></div>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic