| Newsgroups |
gmane.text.xml.xsl.general.mulberrytech |
| Message-ID |
<[email protected]> |
This is a multipart message in MIME format.
------=_NextPart_000_0011_01D742BC.0F07C010
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
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="my:intoLines" as="xs:string*">
<xsl:param name="arg" as="xs:string?" />
<xsl:sequence select="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 will 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
--~----------------------------------------------------------------
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]
--~--
------=_NextPart_000_0011_01D742BC.0F07C010
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40"><head><meta http-equiv=3DContent-Type content=
=3D"text/html; charset=3Dus-ascii"><meta name=3DGenerator content=3D"Micros=
oft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--></head><body lang=3DEN-NZ link=3D"#0563C1=
" vlink=3D"#954F72" style=3D'word-wrap:break-word'><div class=3DWordSection=
1><p class=3DMsoNormal>Hi<o:p></o:p></p><p class=3DMsoNormal><o:p> </o=
:p></p><p class=3DMsoNormal>Turning xml like this:<o:p></o:p></p><p class=
=3DMsoNormal><o:p> </o:p></p><p class=3DMsoNormal><textlines>thi=
s is line 1<o:p></o:p></p><p class=3DMsoNormal>this is line 2<o:p></o:p></p=
><p class=3DMsoNormal>this is line 3</textlines><o:p></o:p></p><p cla=
ss=3DMsoNormal><o:p> </o:p></p><p class=3DMsoNormal>into something lik=
e this:<o:p></o:p></p><p class=3DMsoNormal><o:p> </o:p></p><p class=3D=
MsoNormal><textlines><o:p></o:p></p><p class=3DMsoNormal><line>=
this is line 1</line><o:p></o:p></p><p class=3DMsoNormal><line>=
this is line 2</line><o:p></o:p></p><p class=3DMsoNormal><line>=
this is line 3</line><o:p></o:p></p><p class=3DMsoNormal></textlin=
es><o:p></o:p></p><p class=3DMsoNormal><o:p> </o:p></p><p class=3DM=
soNormal>is simple and I have functions that do it. But they rely on <te=
xtlines> being an xs:string, which is processed by a trivial function I =
wrote:<o:p></o:p></p><p class=3DMsoNormal><o:p> </o:p></p><p class=3DM=
soNormal><xsl:function name=3D"my:intoLines" as=3D"xs:str=
ing*"><o:p></o:p></p><p class=3DMsoNormal> <xsl:param name=
=3D"arg" as=3D"xs:string?" /><o:p></o:p></p><p class=
=3DMsoNormal> <xsl:sequence select=3D"tokenize( $arg, '(\r\n?=
|\n\r?)' )" /><o:p></o:p></p><p class=3DMsoNormal></xsl:function=
><o:p></o:p></p><p class=3DMsoNormal><o:p> </o:p></p><p class=3DMso=
Normal>I would like to extend this so that it can handle an element consist=
ing of text lines with some embedded markup (there won't be much, but there=
will be some). For example, taking:<o:p></o:p></p><p class=3DMsoNormal><o:=
p> </o:p></p><p class=3DMsoNormal><textlines>this is line <se=
q>1</seq><o:p></o:p></p><p class=3DMsoNormal>this is <var>li=
ne</var> 2<o:p></o:p></p><p class=3DMsoNormal>this <emph>is<=
/emph> line 3</textlines><o:p></o:p></p><p class=3DMsoNormal><o:p>=
</o:p></p><p class=3DMsoNormal>and producing<o:p></o:p></p><p class=
=3DMsoNormal><o:p> </o:p></p><p class=3DMsoNormal><textlines><o:=
p></o:p></p><p class=3DMsoNormal><line>this is line <seq>1</=
seq></line><o:p></o:p></p><p class=3DMsoNormal><line>this is=
<var>line</var> 2</line><o:p></o:p></p><p class=3DMsoNor=
mal><line>this <emph>is</emph> line 3</line><o:p></=
o:p></p><p class=3DMsoNormal></textlines><o:p></o:p></p><p class=3DMs=
oNormal><o:p> </o:p></p><p class=3DMsoNormal>Sequence and tokenize isn=
't adequate but is there a way to do this that won't overtax my brain too m=
uch?<o:p></o:p></p><p class=3DMsoNormal><o:p> </o:p></p><p class=3DMso=
Normal>cheers<o:p></o:p></p><p class=3DMsoNormal>T<o:p></o:p></p></div></bo=
dy></html>
<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>
------=_NextPart_000_0011_01D742BC.0F07C010--