Re: [xsl] Linking to a 6 level tag content

Subject: Re: [xsl] Linking to a 6 level tag content
From: Jon Gorman <jonathan.gorman@xxxxxxxxx>
Date: Tue, 28 Jun 2005 09:29:19 -0500
> But still get a ridiculous output:

[snipped out the output]

>
> that's per number.... anyway I can 'hide' the namespaces from the output?

It shouldn't be per number.  It should just have the namespaces
associated with the root element.  You do have a root element,
correct?  Otherwise it's not valid xml and I'm not sure what would
happen since you don't have an xsl:output.  Someone who knows more
about the various processors out there will have to tell you more
about that.

But in this case since that p is the only element, and hence the root
element, it gets all the namespace declarations.  It's working exactly
as it should.  Check out exclude-prefixes, although I believe this
behaves differently on different implementations.

<xsl:template match="text:p">
       <p xsl:exclude-result-prefixes="office table style text draw fo
xlink meta math dc number chart dr3d form script ooo ooow oooc svg dom
xsd xsi xforms">     <xsl:value-of select="."/></p>
               </xsl:template>


On the other hand, doing something similar to
<xsl:template match="text:p">
<xsl:element name="p">
<xsl:value-of select="."/>
</xsl:element>

might work if I call correctly depending on the processor (xslt 1.0 vs
xslt 1.0 backwards-compatible).


Doing something with local-name also could do the trick.  There should
be plenty out there on this stuff if you just google/read the faqs.



Also notice I cleaned up the match.  XSLT default templates will
travel down the input document's tree, so you don't need to have that
long match.  If you have other text, then you might want to modify the
identity transform so that it suppresses text by default (see the faq
on identity transform).

Do you really need all those namespaces in the input anyhow?  I know
office adds a lot by default but I'd be really surprised to see a doc
that uses more than three or four of those namespaces at the most.


Jon Gorman

Current Thread