| Newsgroups |
gmane.text.xml.xsl.general.mulberrytech |
| Message-ID |
<[email protected]> |
--0000000000005b83fa05bfedf50c
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Hi,
Yep, this is essentially an overlap problem.
What a wonderful thing, that we have workable solutions. :->
Cheers, Wendell
On Wed, Apr 14, 2021 at 5:55 AM Geert Bormans [email protected] <
[email protected]> wrote:
> Hi Trevor,
>
> One option would be to replace the mixed content elements by empty elemen=
ts
> <var>n<superscript>th</superscript></var>
> to become
> <var type=3D"s" id=3D"ID01"/>n<superscript type=3D"s" id=3D"ID02"/>th<su=
perscript
> type=3D"e" id=3D"ID02"><var type=3D"r" id=3D"ID01"/>
>
> if so all your characters are siblings, so can do a line breaking
> algorithm, preserving the empty elements
> after that you simply reconstruct the elements
>
> Met vriendelijke groeten,
> Best regards,
>
> Geert Bormans
>
> ----- Op 14 apr 2021 om 11:46 schreef Trevor Nicholls
> [email protected] <[email protected]>:
>
> NB currently XSL 2.0
>
>
>
> I'm struggling with what I thought would be a simple enough problem:
>
>
>
> given content like this
>
>
>
> "<code>Mixed content, mainly text but with some text such as <var>variable
> names</var> wrapped in elements, sometimes nested like a reference to the
> <var>n<superscript>th</superscript></var> occurrence.</code>"
>
>
>
> and a constraint that code should be rendered within a fixed width box, I
> need to come up with a template which will process the <code> element and
> transform it into its word-wrapped equivalent.
>
>
>
> I don't need to concern myself with character sizes or styles; the output
> of this transformation will always be rendered in a fixed-width font.
>
>
>
> I can write something which works fine if a <code> element is simple text
> - but the requirement is for this to work with mixed content too. In the
> above example, if the constraint is that the line must wrap at or before =
64
> characters, the first break comes in the middle of the first <var>.
>
>
>
> Assuming that the <code> example above is the current element, what I am
> trying to write is a template
>
>
>
> <xsl:template name=3D"wordwrap">
>
> <xsl:param name=3D"input" select=3D"." />
>
> <xsl:param name=3D"linelen" select=3D"64" />
>
> =E2=80=A6
>
> </xsl:template>
>
>
>
> that will output
>
>
>
> "Mixed content, mainly text but with some text such as
> <var>variable</var><wordwrap/>
>
> <var>names</var> wrapped in elements, sometimes nexted like a reference
> to<wordwrap/>
>
> the <var>n<superscript>th</superscript></var> occurrence."
>
>
>
> Can anyone offer me some pointers as to how I should implement this?
>
>
>
> Cheers
>
> T
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/554170> (by
> email)
>
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/174322> (by
> email <>)
>
--=20
...Wendell Piez... ...wendell -at- nist -dot- gov...
...wendellpiez.com... ...pellucidliterature.org... ...pausepress.org...
...github.com/wendellpiez... ...gitlab.coko.foundation/wendell...
--~----------------------------------------------------------------
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]
--~--
--0000000000005b83fa05bfedf50c
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hi,<div><br></div><div>Yep, this is essentially an overlap=
=C2=A0problem.</div><div><br></div><div>What a wonderful thing, that we hav=
e workable solutions. :-></div><div><br></div><div>Cheers, Wendell</div>=
<div><br></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=
=3D"gmail_attr">On Wed, Apr 14, 2021 at 5:55 AM Geert Bormans <a href=3D"ma=
ilto:[email protected]">[email protected]</a> <<a href=
=3D"mailto:[email protected]">xsl-list-service@lists.=
mulberrytech.com</a>> wrote:<br></div><blockquote class=3D"gmail_quote" =
style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);pa=
dding-left:1ex"><div><div style=3D"font-family:Arial;font-size:10pt;color:r=
gb(0,0,0)"><div>Hi Trevor,</div><div><br></div><div>One option would be to =
replace the mixed content elements by empty elements</div><div><span style=
=3D"color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14.6667px;fon=
t-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-=
weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-tran=
sform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255=
,255);text-decoration-style:initial;text-decoration-color:initial;float:non=
e;display:inline"><var>n<superscript>th</superscript><=
/var></span><div style=3D"clear:both">to become</div><div style=3D"clear=
:both"><span style=3D"color:rgb(0,0,0);font-family:Calibri,sans-serif;font-=
size:14.6667px;font-style:normal;font-variant-ligatures:normal;font-variant=
-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-in=
dent:0px;text-transform:none;white-space:normal;word-spacing:0px;background=
-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color=
:initial;float:none;display:inline"><span style=3D"color:rgb(0,0,0);font-fa=
mily:Calibri,sans-serif;font-size:14.6667px;font-style:normal;font-variant-=
ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:no=
rmal;text-align:start;text-indent:0px;text-transform:none;white-space:norma=
l;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:=
initial;text-decoration-color:initial;float:none;display:inline"><span styl=
e=3D"color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14.6667px;fo=
nt-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font=
-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-tra=
nsform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,25=
5,255);text-decoration-style:initial;text-decoration-color:initial;float:no=
ne;display:inline"><var type=3D"s" id=3D"ID01"/>n=
<superscript <span>=C2=A0</span>type=3D"s" id=3D"ID02&quo=
t;/</span></span></span><span style=3D"color:rgb(0,0,0);font-family:Calibri=
,sans-serif;font-size:14.6667px;font-style:normal;font-variant-ligatures:no=
rmal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-al=
ign:start;text-indent:0px;text-transform:none;white-space:normal;word-spaci=
ng:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text=
-decoration-color:initial;float:none;display:inline"><span style=3D"color:r=
gb(0,0,0);font-family:Calibri,sans-serif;font-size:14.6667px;font-style:nor=
mal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;=
letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;=
white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-=
decoration-style:initial;text-decoration-color:initial;float:none;display:i=
nline"><span style=3D"color:rgb(0,0,0);font-family:Calibri,sans-serif;font-=
size:14.6667px;font-style:normal;font-variant-ligatures:normal;font-variant=
-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-in=
dent:0px;text-transform:none;white-space:normal;word-spacing:0px;background=
-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color=
:initial;float:none;display:inline">>th<superscript<span>=C2=A0</span=
><span style=3D"color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:1=
4.6667px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:=
normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0=
px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration-=
style:initial;text-decoration-color:initial">=C2=A0</span>type=3D"e&qu=
ot; id=3D"ID02"</span></span></span><span style=3D"color:rgb(0,0,=
0);font-family:Calibri,sans-serif;font-size:14.6667px;font-style:normal;fon=
t-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-=
spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-s=
pace:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decorat=
ion-style:initial;text-decoration-color:initial;float:none;display:inline">=
<span style=3D"color:rgb(0,0,0);font-family:Calibri,sans-serif;font-size:14=
.6667px;font-style:normal;font-variant-ligatures:normal;font-variant-caps:n=
ormal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0p=
x;text-transform:none;white-space:normal;word-spacing:0px;background-color:=
rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initia=
l;float:none;display:inline">><var=C2=A0<span>=C2=A0</span>type=3D&qu=
ot;r" id=3D"ID01"/></span></span><span style=3D"color:rgb=
(0,0,0);font-family:Calibri,sans-serif;font-size:14.6667px;font-style:norma=
l;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;le=
tter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;wh=
ite-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-de=
coration-style:initial;text-decoration-color:initial;float:none;display:inl=
ine"></span><div style=3D"clear:both"><br></div><div style=3D"clear:both">i=
f so all your characters are siblings, so can do a line breaking algorithm,=
preserving the empty elements</div><div style=3D"clear:both">after that yo=
u simply reconstruct the elements</div></div></div><div><br></div><div><div=
>Met vriendelijke groeten,<br>Best regards,<br><br>Geert Bormans<br></div><=
/div><div><br><span id=3D"gmail-m_6819433899129429828zwchr">----- Op 14 apr=
2021 om 11:46 schreef Trevor Nicholls <a href=3D"mailto:trevor@castingthev=
oid.com" target=3D"_blank">[email protected]</a> <<a href=3D"mai=
lto:[email protected]" target=3D"_blank">xsl-list-ser=
[email protected]</a>>:<br></span><br></div><div><div><p class=
=3D"MsoNormal">NB currently XSL 2.0</p><p class=3D"MsoNormal">=C2=A0</p><p =
class=3D"MsoNormal">I'm struggling with what I thought would be a simpl=
e enough problem:</p><p class=3D"MsoNormal">=C2=A0</p><p class=3D"MsoNormal=
">given content like this</p><p class=3D"MsoNormal">=C2=A0</p><p class=3D"M=
soNormal">"<code>Mixed content, mainly text but with some text s=
uch as <var>variable names</var> wrapped in elements, sometimes=
nested like a reference to the <var>n<superscript>th</super=
script></var> occurrence.</code>"</p><p class=3D"MsoNor=
mal">=C2=A0</p><p class=3D"MsoNormal">and a constraint that code should be =
rendered within a fixed width box, I need to come up with a template which =
will process the <code> element and transform it into its word-wrappe=
d equivalent.</p><p class=3D"MsoNormal">=C2=A0</p><p class=3D"MsoNormal">I =
don't need to concern myself with character sizes or styles; the output=
of this transformation will always be rendered in a fixed-width font.</p><=
p class=3D"MsoNormal">=C2=A0</p><p class=3D"MsoNormal">I can write somethin=
g which works fine if a <code> element is simple text - but the requi=
rement is for this to work with mixed content too. In the above example, if=
the constraint is that the line must wrap at or before 64 characters, the =
first break comes in the middle of the first <var>.</p><p class=3D"Ms=
oNormal">=C2=A0</p><p class=3D"MsoNormal">Assuming that the <code> ex=
ample above is the current element, what I am trying to write is a template=
</p><p class=3D"MsoNormal">=C2=A0</p><p class=3D"MsoNormal"><xsl:templat=
e name=3D"wordwrap"></p><p class=3D"MsoNormal">=C2=A0 <xsl:=
param name=3D"input" select=3D"." /></p><p class=3D"=
MsoNormal">=C2=A0 <xsl:param name=3D"linelen" select=3D"6=
4" /></p><p class=3D"MsoNormal">=E2=80=A6</p><p class=3D"MsoNormal"=
></xsl:template></p><p class=3D"MsoNormal">=C2=A0</p><p class=3D"MsoN=
ormal">that will output</p><p class=3D"MsoNormal">=C2=A0</p><p class=3D"Mso=
Normal">"Mixed content, mainly text but with some text such as <var=
>variable</var><wordwrap/></p><p class=3D"MsoNormal"><var=
>names</var> wrapped in elements, sometimes nexted like a referenc=
e to<wordwrap/></p><p class=3D"MsoNormal">the <var>n<supersc=
ript>th</superscript></var> occurrence."</p><p class=3D=
"MsoNormal">=C2=A0</p><p class=3D"MsoNormal">Can anyone offer me some point=
ers as to how I should implement this?</p><p class=3D"MsoNormal">=C2=A0</p>=
<p class=3D"MsoNormal">Cheers</p><p class=3D"MsoNormal">T</p></div>
<div>
<div style=3D"border-top:1px solid black;background-color:rgb(221,221,221);=
color:rgb(136,136,136);font-size:smaller;padding:5px;text-align:center;font=
-family:arial,verdana,arial,sans-serif;margin:auto">
<a href=3D"http://www.mulberrytech.com/xsl/xsl-list" rel=3D"nofollow noopen=
er noreferrer" target=3D"_blank">
XSL-List info and archive</a>
<div style=3D"text-align:center">
<a style=3D"color:blue" href=3D"http://lists.mulberrytech.com/unsub/xsl-lis=
t/554170" rel=3D"nofollow noopener noreferrer" target=3D"_blank">EasyUnsubs=
cribe</a>
(<a style=3D"color:blue" rel=3D"nofollow noopener noreferrer">by email</a>)
</div>
</div>
</div><br></div></div></div>
<div>
<div style=3D"border-top:1px solid black;background-color:rgb(221,221,221);=
color:rgb(136,136,136);font-size:smaller;padding:5px;text-align:center;font=
-family:arial,verdana,arial,sans-serif;clear:both;margin:auto">
<a href=3D"http://www.mulberrytech.com/xsl/xsl-list" target=3D"_blank">
XSL-List info and archive</a>
<div style=3D"text-align:center">
<a style=3D"color:blue" href=3D"http://lists.mulberrytech.com/unsub/xsl-lis=
t/174322" target=3D"_blank">EasyUnsubscribe</a>
(<a style=3D"color:blue" href=3D"" target=3D"_blank">by email</a>)
</div>
</div>
</div>
</blockquote></div><br clear=3D"all"><div><br></div>-- <br><div dir=3D"ltr"=
class=3D"gmail_signature">...Wendell Piez... ...wendell -at- nist -dot- go=
v...<br>...wendellpiez.com... ...pellucidliterature.org... ...pausepress.or=
g...<br>...<a href=3D"http://github.com/wendellpiez." target=3D"_blank">git=
hub.com/wendellpiez.</a>.. ...gitlab.coko.foundation/wendell... </div>
<div><!-- begin bl.html.trailer -->
<div style=3D"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=3D"http://www.mulberrytech.com/xsl/xsl-list">
XSL-List info and archive</a>
<div style=3D"text-align:center;">
<a style=3D"color: blue;"
href=3D"http://lists.mulberrytech.com/unsub/xsl-list/3329386"
>EasyUnsubscribe</a>
(<a style=3D"color: blue;"
href=3D"mailto:[email protected]?subject=3Dremove"
>by email</a>)
</div>
</div>
<!-- end bl.html.trailer --></div>
--0000000000005b83fa05bfedf50c--