Re: [xslt] newbie question



On Fri, 10 Aug 2001, darrell dupas wrote:

> i have been tinkering with xsltproc and the heavily ms oriented xslt
> tutorial at w3schools,
>
> http://www.w3schools.com/xsl/xsl_choose.asp

Microsoft has two forms of XSLT. The old form of XSLT, which is designated
"WD-xsl", is not supported by almost any other XSLT processor in existence.
Make sure that their examples don't follow that form before you apply them to
libxslt.

> to get the simple examples to work with xsltproc you must change the
> namespace tag, and add version="1.0", and indeed i have done a few
> simple transformations, however the xsl:if and xsl:choose are not
> working for me, i am unsure what is wrong with the xpath in the expression
>
> <xsl:if match=".[ARTIST='Bob Dylan']">

Try to see if 'match="ARTIST='Bob Dylan'"' works.

> if i read this correctly the dot means the current node in the for each,
> and the ARTIST node  should be inside the nodes returned by the
> following selector:
>
> <xsl:for-each select="CATALOG/CD">

An easier way of saying all this might be 'select="CATALOG/CD[ARTIST='Bob
Dylan']"'.

> i am getting frustrated with the lack of practical examples on xpath ,
> and yes i read http://www.w3.org/TR/xpath.html,

XPath doesn't really have that many applications outside of XSLT.

> also i have found the
> lack of explanation of URI vs. URL frustrating, please correct me if i
> am wrong, they are essentially the same thing except that a uri is not
> necessarily an absolute or relative path, it may resolve to different
> locations, they don't specify protocol like <!DOCTYPE html PUBLIC
> "-//W3C//DTD HTML 4.01 Transitionl/EN">is a uri because it could be at
> any W3C ? ah, i will keep on ....

A URL is a form of a URI. So is a URN. Don't worry about the small
differences; they don't seem to be that important anyways.

> i am planning on making a basic xml database program using libxml2, one
> small hint about  the xslt equivalent of the SQL insert into would be
> nice?  just a clue please, you don't need to provide an example, or
> perhaps i should use the c api instead of xslt?

SQL is a database manipulation language. XSLT is a transformation language. As
such, they have no direct correlation.

> root@h24-70-78-59:~/ddupas# xsltproc --version
> Using libxml 20400, libxslt 10000 and libexslt 100
> xsltproc was compiled against libxml 20400, libxslt 10000 and libexslt 100
> libxslt 10000 was compiled against libxml 20400
> libexslt 100 was compiled against libxml 20400
>
> thank you
>
> darrell
> ddupasedm@netscape.net

If you need to get knee-deep into XSLT, then I suggest you pick up a copy of
Wrox Press's "XSLT Programmer's Reference, 2nd edition". Michael H. Kay, the
author of the book, has written an XSLT engine himself, so he knows what he's
talking about.

-- 
Ignacio Vazquez-Abrams  <ignacio@openservices.net>






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]