Subject: RE: XSLT Newbie - Need help with DOCTYPE, namespaces, and stuff
From: Daniel Lo Nigro <dansoftaus@xxxxxxxxxxxx>
Date: Fri, 27 Apr 2007 18:49:11 +1000 (EST)
|
Thank you for your quick response, I appreciate it (tt
helped me solved my problem :))
For anyone that's wondering, I needed to add the
namespace to the xsl:stylesheet tag. In my case, it
turned out like:
<xsl:stylesheet
version="1.0"
xmlns:pack="http://www.simplemachines.org/xml/package-info"
xmlns:smf="http://www.simplemachines.org/"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
Then, I needed to prefix everything with "pack:" (eg.
<xsl:value-of select="pack:package-info/pack:id" />)
-- Daniel15
--- Michael Kay <mike@xxxxxxxxxxxx> wrote:
> Google for "XSLT default namespace" and you'll find
> lots of advice on this.
>
> The short answer is: your elements are in a
> namespace, so to select them you
> need to use prefixed names in your match patterns
> and path expressions, with
> a prefix (any prefix will do) that's bound to that
> namespace.
>
> Michael Kay
> http://www.saxonica.com/
>
> > -----Original Message-----
> > From: Daniel Lo Nigro
> [mailto:dansoftaus@xxxxxxxxxxxx]
> > Sent: 26 April 2007 12:27
> > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: XSLT Newbie - Need help with
> DOCTYPE,
> > namespaces, and stuff
> >
> > Hi everyone,
> > I'm making a XSLT stylesheet for XML files for
> SMF
> > (simplemachines.org) modifications. Even though
> the XSLT
> > stylesheet looks correct, it doesn't seem to work
> with the
> > XML files. However, when I comment out the doctype
> (and
> > remove the xmlns="" from the root element), the
> XSLT
> > stylesheet works fine.
> >
> > Here's what the XML file looks like normally:
> > ===
> > <?xml version="1.0"?>
> > <?xml-stylesheet href="package-info.xsl"
> > type="text/xsl"?>
> > <!DOCTYPE package-info SYSTEM
> > "http://www.simplemachines.org/xml/package-info">
> >
> > <package-info
> >
>
xmlns="http://www.simplemachines.org/xml/package-info"
> > xmlns:smf="http://www.simplemachines.org/">
> > ...
> > </package-info>
> > ===
> >
> > And here's how I edited it to make it work:
> > ===
> > <?xml version="1.0"?>
> > <?xml-stylesheet href="package-info.xsl"
> > type="text/xsl"?>
> >
> > <package-info>
> > ...
> > </package-info>
> > ===
> >
> > My question is, how do I make it work with XML
> files that
> > have the doctype and xmlns defined?
> >
> > The XSLT stylesheet was originally made using
> Dreamweaver 8,
> > but I eventually recoded most of it in a plain
> text editor.
> >
> > XSLT stylesheet:
> >
>
http://server.daniel15.com/smf/xml/xslt/package-info.xsl
> > Working XML file:
> >
>
http://dev.dansoftaustralia.net/svn/modparser/trunk/xslt/packa
> > ge-info.xml
> > Non-working XML file:
> >
>
http://dev.dansoftaustralia.net/svn/modparser/trunk/xslt/packa
> > ge-info2.xml
> >
> > Thanks :)
> > -- Daniel15
> >
> > Send instant messages to your online friends
> > http://au.messenger.yahoo.com
>
>
Send instant messages to your online friends http://au.messenger.yahoo.com
|