l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2003 Dec 16 18:53

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] XSLT questions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] XSLT questions


> That would not make valid XHTML (assuming you're generating XHTML
> 1.). Your <xsl:stylesheet> opening tag should contain something like:
>   xmlns="http://www.w3.org/1999/xhtml";

It was, in fact, the XHTML validator that made me realize that I had a
problem in the first place.  I had the xmlns string in the stylesheet
earlier, but had removed it for some reason.  I put it back and, like
magic, I have validating XHTML code.  Thanks!

> Some processors provide extensions to convert a result fragment into a
> node set; but you should be able to do the same thing in another way
> (XSLT is Turing complete, after all). You haven't really given much
> information on what it is you want to achieve: can you give an example
> of what you're trying to accomplish?

Well, it isn't a case in which I can't get the result that I want--it's a
case of not being able to do things in the way I want to, so the fact
that XHTML is Turing-complete does not guarantee anything.

Let's say, for instance, that have an XML tag for a project
here's a very contrived example:

<project name="TTP">
The TTP Project is the only project in our company with a fully
recursive acronym.

And I want to convert that to the following XHTML:

<hr />
<img class="sep" src="pretty.png" alt="" />
<hr />
<p><strong>Project name: TTP</strong></p>
<q>The TTP Project is the only project in our company with a fully
   recursive acronym.</p>

This is fine, but suppose that I soon realize that the "sep" image
surrounded by two <hr /> tags is something I use in many places in my
stylesheet, and I want to make it a parameterized entity that I can use
in many settings, like <sepimage src="pretty.png" />.  I don't know how
to do this in XSLT; it seems that I am doomed to repeat the XHTML in each
case, since <sepimage ... /> is not part of the source document.  Suppose
I change my mind and want all these separator images (both those
separating project descriptions and otherwise) to have one <hr /> rather
than two--I'll have to go through my stylesheet and find each place where
I used a separator image and fix it.

Basically, I want subroutines that I can use to abstract common but
parametric elements of my stylesheets, and after going through a number
of XSLT tutorials, I still can't find 'em.

Thanks for your help!  Much appreciated.

vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
EDGE Tech Corp.
For donating some give-aways for our meetings.