xsl-list
[Top] [All Lists]

A few questions to the experts: functions, templates, loops

2002-09-05 03:20:45
Hi there,

I am having some trouble with XML/XSLT, and it would be very nice if
someone could help me with a few questions:

I have created a homepage-generation/management-xslt script using the
data from a xml-database, of course, and saxon. I managed to get
everything running up until now, but there are some things that I would
really like to improve in my script:
1.) How do I write my own functions with return values? For example, I
have a function that traverses the tree, searches a page by id and
delivers the corresponding path-name. My solution up until now has been
to create a template (please, don't laugh at me - I know this is most
probably the worst possible approach) which delivers the name as text.
This works, but... it's sort of.. akward
2.) I would like to have several templates matching e.g. "/test", but
for different purposes. Since I have some apply-templates they tell me
it's ambigous (which it of course is). Is there a way to elegantly
parameterize this?
3.) Is there a way to pass parameters when calling a xml-file? Like
calling "http://...file.xml?param=1"; and the xslt-script can evaluate
that parameter? I only found a way to do it via an xslt-processor, and
since I can't use scripts/cgis/processors... on my server it has to be
done via the xml/xslt purely.
4.) Sometimes I couldn't use templates, e.g. because of ambigouty. Then
I usually used the xsl:for-each statement to select the corresponding
node (e.g. select="/pages/page"). But I don't need the
loop-functionality - is there a simpler statement to do so?
5.) Is there a way to "break out" of a loop?
6.) How do I enter new data in an existing xml-file using saxon? I
didn't find any short, easy examples on that. Can anyone point me to a
source, please?

I know these are a lot of questions, and probably they seem stupid to
many of you gurus out there - but it would really be nice if anyone
could help me with that!

Best regards,

Juggy



XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list