xsl-list
[Top] [All Lists]

Re: [xsl] limit a string to a certain word count

2007-03-14 12:33:51
Hi Abel & all -

 Thank you very much for your advice & pointers.  Getting the scoop
from some humans is a great way to get started into something.

 The tip for using Saxon 8.9+ will really help.  Also that I probably
want 2.0 do
do these things.

  I found these functions online:  http://www.xsltfunctions.com/xsl/alpha.html

  So I am going to go by example & see if I can use the tokenize
function to modify my existing stylesheet call:

<xsl:value-of disable-output-escaping="yes" select="description"/>

into a call that will trim the selected "description"

-Matt

On 3/14/07, Abel Braaksma <abel(_dot_)online(_at_)xs4all(_dot_)nl> wrote:
Matthew Pease wrote:
>
>   Truly tho, I'm a total XSL newbie & am looking for a handout.  :)

XSLT is a very powerful language/tool to have and use, especially so if
you choose to use XSLT 2.0. In your OP you said you were using Java. Add
Saxon 8.9 to your classpath and get your factory settings correct and
you have yourself an XSLT 2.0 processor.

>
>  How might I make an xsl function for this & how would I call it?
> Anyone care to help?
>
>   tokenize($in, '\W')[position() = 1 to $n]

With XSLT 2.0 you can create your own functions, with XSLT 1.0 you
cannot. However, 'tokenize()' is already and XSLT 2.0 function and can
be used right away.

It seems to me that you need some starting pointers. Like: what is an
XSLT Stylesheet, how do you create/initialize one, how do matching
templates work etc. Jeni Tennison wrote an excellent introductory book,
Michael Kay wrote two excellent reference books and on
http://www.w3schools.com you can find a simple tutorial, some examples
and a simple reference (but only XSLT 1.0).

But be warned, you may find it a very useful language and, since it is
so completely different from imperative languages (like Java, VB, C#
etc), you can do many things way easier than you've used to do, but
differently ;)  You may get addicted so watch out!

-- Abel Braaksma
   http://www.nuntia.nl


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--