[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Xpath Syntax Issue

Subject: Re: [xsl] Xpath Syntax Issue
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Sun, 24 Jun 2012 16:31:46 +0100

On 24/06/2012 15:35, Nathan Tallman wrote:
Is there any reason why this transformation works in Oxygen, using
Saxon and xsltproc, yet doesn't work from the Linux command line using
xsltproc? When running from the command line, all the attributes from
urlset are removed, but the unwanted URLs remain.

I for one haven't followed this thread in detail, so I'm not sure what "this transformation" refers to.

Michael Kay

On Sat, Jun 23, 2012 at 10:56 PM, Nathan Tallman<ntallman@xxxxxxxxx> wrote:
Thanks Chris. I had just found this explanation on
when your email came in. This takes care of it.

Much appreciation.

On Sat, Jun 23, 2012 at 10:51 PM, Christopher R. Maden<crism@xxxxxxxxx> wrote:
Hash: SHA1

On 06/23/2012 10:38 PM, Nathan Tallman wrote:
I still wasn't getting the results in my application, so I created
pets.xml and sure enough the template worked. It only works with
my original document if I remove attributes found in the root

The original first 6 lines:<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xsi:schemaLocation=" http://www.sitemaps.org/schemas/sitemap/0.9

I had to remove all attributes from<urlset>  before the XSL would
work. Do I need to reference the schema in my XSL?
Ahh... the good ol namespace FAQ.

Every element type name is a pair: namespace URI and local name.

What you thought was null-namespace plus species is in fact
http://www.sitemaps.org/schemas/sitemap/0.9 plus species (often
written as {http://www.sitemaps.org/schemas/sitemap/0.9}species).  An
XPath expression matching just species matches {}species, which is a
*different name* than

You need, in your XSLT, to declare something like
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9" and then
use sitemap:species in your XPath.  (A shorter prefix might be in
order, but a prefix is required for XSLT 1.0 and recommended (IMO) for
clarity for XSLT 2.0.)

- --
Chris Maden, text nerd<URL: http://crism.maden.org/>
LIVE FREE: vote for Gary Johnson, Libertarian for President.
     <URL: http://garyjohnson2012.com/>    <URL: http://lp.org/>
GnuPG fingerprint: DB08 CF6C 2583 7F55 3BE9  A210 4A51 DBAC 5C5C 3D5E

-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


Current Thread