Page 1 of 1

xpath-default-namespace getting in the way

Posted: Sat Oct 23, 2010 6:19 pm
by sderrick
I am taking over a project that has some existing stylesheets.

One of them has this at the top

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.tei-c.org/ns/1.0"
xpath-default-namespace="http://www.tei-c.org/ns/1.0"
xmlns:ta="http://concord-works.com/tei/augment-functions" exclude-result-prefixes="xs ta" version="2.0">

The sheet works fine processing the existing tei documents.

My problem with it is that I now need to use two source documents accessing the second with the doc() command. This works fine except that I can't access anything in the document. The document is just data contained in plain xml, no dtd, not tei, etc.. If I remove the xpath-default-namespace line from above I can access the data in the second document, but then many of the templates are not recognized during processing because the match="name" doesn't have tei: prepended to them.

My question: Is there a way I can fix this without going through the entire style sheet and finding which match"names" need to have tei: added?

thanks,

Scott

Re: xpath-default-namespace getting in the way

Posted: Sat Oct 23, 2010 9:18 pm
by george
Hi,

The xpath-default-namespace value is inherited from the closer ancestor that defines it. So, just add xpath-default-namespace="" on the templates that match content from the document from no namespace to reset the XPath default namespace to no namespace.

Best Regards,
George

Re: xpath-default-namespace getting in the way

Posted: Sat Oct 23, 2010 11:24 pm
by sderrick
George,

thanks for the reply.

That did the trick!

thanks again,

Scott