There are automated tests that exercise the various Java functions. In
addition, if you run it through the Open Toolkit it does a test that exercises
both English and Simplified Chinese. The project docs are here:
http://www.dita-community.org/org.dita-community.i18n/topics/dita_community_internationalization_plugin.html
Cheers,
E.
--
Eliot Kimber
http://contrext.com
On 5/9/19, 2:41 PM, "Manuel Souto Pico terminolator(_at_)gmail(_dot_)com"
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
Dear all,
I'm impressed and very thankful for all your answers. I'll try to address
all your comments:
@Martin, your example works really well. I had to edit the expression, as
in my real files sometimes they have used lists instead of linebreaks:
<xsl:param name="lb" as="xs:string"></?(li|ul|br)\s*/?></xsl:param>
However, I can see what I would also need to split at the end of sentences
when there's no escaped tag but just final punctuation. To avoid the
transformation eating the punctuation, I have tried with a lookbehind assertion
but it seems it's not supported:
<xsl:param name="lb"
as="xs:string">(?<=[.!?])\s|</?(li|ul|br)\s*/?></xsl:param>
Any ideas?
@Gerrit, I think I can use XSLT 2.0 or XSLT 3.0 (I have downloaded Saxon HE
9.9), but I'm not sure what you mean with your second question. Ther'e might be
leading and trailing tags in the text, but <seg> is the text node, there are no
further elements inside <seg>
@Eliot, thanks for that reference. It would be intersting to see what line
breaking does. Are there any examples I can look at?
Thank you so much again!
Cheers, Manuel
Martin Honnen martin(_dot_)honnen(_at_)gmx(_dot_)de
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> escreveu no dia
quinta, 9/05/2019 à(s) 17:01:
On 09.05.2019 15:44, Manuel Souto Pico terminolator(_at_)gmail(_dot_)com
wrote:
> Do you think I can use XSLT to do this more or less easily?
Yes, XSLT 3 can do it easily, using tokenize to split the segments and
then grouping to group the different segments together:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
exclude-result-prefixes="#all"
version="3.0">
<xsl:mode on-no-match="shallow-copy"/>
<xsl:output indent="yes"/>
<xsl:param name="lb" as="xs:string"><br></xsl:param>
<xsl:template match="tu">
<xsl:variable name="split">
<xsl:apply-templates mode="split"/>
</xsl:variable>
<xsl:for-each-group select="$split/tuv/seg" group-by="position()
mod count($split/tuv[1]/seg)">
<tu tuid="{position()}">
<xsl:apply-templates select="current-group()/snapshot()/.."/>
</tu>
</xsl:for-each-group>
</xsl:template>
<xsl:mode name="split" on-no-match="shallow-copy"/>
<xsl:template match="seg" expand-text="yes" mode="split">
<xsl:for-each select="tokenize(., '(' || $lb || ')+')">
<seg>{.}</seg>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
https://xsltfiddle.liberty-development.net/ej9EGcD/1
XSL-List info and archive
<http://www.mulberrytech.com/xsl/xsl-list>EasyUnsubscribe
<http://lists.mulberrytech.com/unsub/xsl-list/1278982>
(by email <>)
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--