Subject: Re: [xsl] Namespace conflicts processing Word documents From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Mon, 06 Oct 2008 12:33:01 -0400 |
<xsl:template name="make-h1"> <xsl:param name="contents"> <xsl:apply-templates/> </xsl:param> <h1> <xsl:copy-of select="$contents"/> </h1> </xsl:template>
<xsl:template match="w:p[w:pPr[w:pStyle[@w:val='Heading1']]]"> <xsl:call-template name="make-h1"/> </xsl:template>
<xsl:template match="w:p[w:pPr[w:pStyle[@w:val='Heading1']]]]" mode="special> <xsl:call-template name="make-h1"> <xsl:with-param name="contents"> <xsl:apply-templates mode="special"/> </xsl:with-param> </xsl:call-template> </xsl:template>
Cheers, Wendell
Right, so I can have two otherwise identical stylesheets, one declaring the WordML w: namespace and the other declaring the OOXML w: namespace, with both using the identical
<xsl:template match="w:p[w:pPr[w:pStyle[@w:val='Heading1']]]">
<h1><xsl:apply-templates/></h1>
</xsl:template>
but I can't have a shell stylesheet for each namespace which both import/include the template code from a common (shared) file, because (a) namespaces don't get inherited into imports/includes, and (b) the common file will necessarily lack any namespace declaration for w: and will therefore not be well-formed.
OK. So long as I wasn't missing a trick there.
What I think you are missing is that an XSLT stylesheet has no obligation to use the same prefix as another XSLT stylesheet or any XML document being used as a source file.
Except that when it comes to process the document, the declared namespace URI (IRI) must be the same in both the stylesheet and the document.
I was hoping to do without preprocessing, but as this is all in Cocoon anyway, pipelining it isn't really a problem.
///Peter
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] Namespace conflicts proce, G. Ken Holman | Thread | [xsl] matching elements by name and, Andrew Welch |
Re: [xsl] Namespace conflicts proce, G. Ken Holman | Date | [xsl] matching elements by name and, Andrew Welch |
Month |