xpath-default-namespace getting in the way

Here should go questions about transforming XML with XSLT and FOP.
sderrick
Posts: 264
Joined: Sat Jul 10, 2010 4:03 pm

xpath-default-namespace getting in the way

Post 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
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: xpath-default-namespace getting in the way

Post 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
George Cristian Bina
sderrick
Posts: 264
Joined: Sat Jul 10, 2010 4:03 pm

Re: xpath-default-namespace getting in the way

Post by sderrick »

George,

thanks for the reply.

That did the trick!

thanks again,

Scott
Post Reply