| Newsgroups |
gmane.text.xml.xsl.general.mulberrytech |
| Message-ID |
<[email protected]> |
This is a multipart message in MIME format.
------=_NextPart_000_0001_01D73176.B4679C30
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
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="wordwrap">
<xsl:param name="input" select="." />
<xsl:param name="linelen" select="64" />
.
</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/3329386
or by email: [email protected]
--~--
------=_NextPart_000_0001_01D73176.B4679C30
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>NB currently XSL 2.0<o:p></o:p></p><p class=3DMsoNor=
mal><o:p> </o:p></p><p class=3DMsoNormal>I'm struggling with what I th=
ought would be a simple enough problem:<o:p></o:p></p><p class=3DMsoNormal>=
<o:p> </o:p></p><p class=3DMsoNormal>given content like this<o:p></o:p=
></p><p class=3DMsoNormal><o:p> </o:p></p><p class=3DMsoNormal>"&=
lt;code>Mixed content, mainly text but with some text such as <var>=
;variable names</var> wrapped in elements, sometimes nested like a re=
ference to the <var>n<superscript>th</superscript></va=
r> occurrence.</code>"<o:p></o:p></p><p class=3DMsoNormal><o:=
p> </o:p></p><p class=3DMsoNormal>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-wrapp=
ed equivalent.<o:p></o:p></p><p class=3DMsoNormal><o:p> </o:p></p><p c=
lass=3DMsoNormal>I don't need to concern myself with character sizes or sty=
les; the output of this transformation will always be rendered in a fixed-w=
idth font.<o:p></o:p></p><p class=3DMsoNormal><o:p> </o:p></p><p class=
=3DMsoNormal>I can write something which works fine if a <code> eleme=
nt is simple text - but the requirement is for this to work with mixed cont=
ent 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 fir=
st <var>.<o:p></o:p></p><p class=3DMsoNormal><o:p> </o:p></p><p =
class=3DMsoNormal>Assuming that the <code> example above is the curre=
nt element, what I am trying to write is a template<o:p></o:p></p><p class=
=3DMsoNormal><o:p> </o:p></p><p class=3DMsoNormal><xsl:template nam=
e=3D"wordwrap"><o:p></o:p></p><p class=3DMsoNormal> <=
xsl:param name=3D"input" select=3D"." /><o:p></o:p><=
/p><p class=3DMsoNormal> <xsl:param name=3D"linelen" sel=
ect=3D"64" /><o:p></o:p></p><p class=3DMsoNormal>…<o:p><=
/o:p></p><p class=3DMsoNormal></xsl:template><o:p></o:p></p><p class=
=3DMsoNormal><o:p> </o:p></p><p class=3DMsoNormal>that will output<o:p=
></o:p></p><p class=3DMsoNormal><o:p> </o:p></p><p class=3DMsoNormal>&=
quot;Mixed content, mainly text but with some text such as <var>varia=
ble</var><wordwrap/><o:p></o:p></p><p class=3DMsoNormal><var=
>names</var> wrapped in elements, sometimes nexted like a referenc=
e to<wordwrap/><o:p></o:p></p><p class=3DMsoNormal>the <var>n&l=
t;superscript>th</superscript></var> occurrence."<o:p><=
/o:p></p><p class=3DMsoNormal><o:p> </o:p></p><p class=3DMsoNormal>Can=
anyone offer me some pointers as to how I should implement this?<o:p></o:p=
></p><p class=3DMsoNormal><o:p> </o:p></p><p class=3DMsoNormal>Cheers<=
o:p></o:p></p><p class=3DMsoNormal>T<o:p></o:p></p></div></body></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_0001_01D73176.B4679C30--