| Newsgroups |
gmane.text.xml.xsl.general.mulberrytech |
| Message-ID |
<[email protected]> |
Hi,
=46rom Gerrit I would have expected something like
<xsl:for-each-group select=3D"node()" group-starting-with=3D"text()[matches=
(., '^
')]">
...=20=20=20=20
</xsl:for-each-group>
but it is possibly too much hassle to handle corner cases.=20
Because I assume it is very likely that inline elements may run across line=
breaks, it is time for Gerrit=E2=80=99s "Upward Projection", see https://a=
rchive.xmlprague.cz/2019/files/xmlprague-2019-proceedings.pdf#page=3D347
- Michael MH
> Am 06.05.2021 um 11:14 schrieb Imsieke, Gerrit, le-tex gerrit.imsieke@le-=
tex.de <[email protected]>:
>=20
> Hi Trevor,
>=20
> If the markup in the lines doesn't stretch across line breaks, you can in=
sert empty elements for each line break using xsl:analyze-string in a first=
pass.
>=20
> In the second pass, you then group the nodes below textlines, starting or=
ending with such an empty linebreak element that you introduced in the fir=
st pass.
>=20
> Gerrit
>=20
> On 06.05.2021 11:09, Trevor Nicholls [email protected] wrote:
>> Hi
>> Turning xml like this:
>> <textlines>this is line 1
>> this is line 2
>> this is line 3</textlines>
>> into something like this:
>> <textlines>
>> <line>this is line 1</line>
>> <line>this is line 2</line>
>> <line>this is line 3</line>
>> </textlines>
>> is simple and I have functions that do it. But they rely on <textlines> =
being an xs:string, which is processed by a trivial function I wrote:
>> <xsl:function name=3D"my:intoLines" as=3D"xs:string*">
>> <xsl:param name=3D"arg" as=3D"xs:string?" />
>> <xsl:sequence select=3D"tokenize( $arg, '(\r\n?|\n\r?)' )" />
>> </xsl:function>
>> I would like to extend this so that it can handle an element consisting =
of text lines with some embedded markup (there won't be much, but there wil=
l be some). For example, taking:
>> <textlines>this is line <seq>1</seq>
>> this is <var>line</var> 2
>> this <emph>is</emph> line 3</textlines>
>> and producing
>> <textlines>
>> <line>this is line <seq>1</seq></line>
>> <line>this is <var>line</var> 2</line>
>> <line>this <emph>is</emph> line 3</line>
>> </textlines>
>> Sequence and tokenize isn't adequate but is there a way to do this that =
won't overtax my brain too much?
>> cheers
>> T
>=20
>=20
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/3329386
or by email: [email protected]
--~--