This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: Newbie: template match using a mix of namespace prefix and none p refix
- From: Palmer Magnus <Magnus dot Palmer at tetrapak dot com>
- To: "'Jeni Tennison'" <jeni at jenitennison dot com>
- Cc: "'XSL-List at lists dot mulberrytech dot com'" <XSL-List at lists dot mulberrytech dot com>
- Date: Mon, 9 Sep 2002 10:58:01 +0200
- Subject: RE: [xsl] Newbie: template match using a mix of namespace prefix and none p refix
- Reply-to: xsl-list at lists dot mulberrytech dot com
Hi Tennison,
> 1) Absolute path, not working
> <xsl:template
>
match="/msg/req/dta/SHOW_PO_007/DATAAREA/SHOW_PO/POHEADER/of:USERAREA/of:TRA
> NSMETHD" mode="copy">
<<My guess would be that these paths aren't working because the msg,
<<req, dta, SHOW_PO_007, DATAAREA, SHOW_PO and/or POHEADER elements are
<<in a namespace in your XML document. Without seeing your source
<<document I can't tell, but this seems to be the most likely
<<explanation.
The namespaces are as following:
<xsl:stylesheet version="1.0"
xmlns="x-schema:http://scshost/schemas/oagis/7.1/011_show_po_007.xdr"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:of="x-schema:http://scshost/schemas/oagis/7.1/oagis_fields.xdr"
xmlns:os="x-schema:http://scshost/schemas/oagis/7.1/oagis_segments.xdr"
xmlns:scala="x-schema:http://scshost/schemas/oagis/7.1/scala_fields.xdr"
>
Hence I asume that the default namespace is using the 011_show_po_007.xdr
namespace.
These namespaces are declared in the SHOW_PO_007 element of the incoming
source document.
This is a partial trace from Saxon:
</Source><!--
/msg[1]/req[1]/dta[1]/SHOW_PO_007[1]/DATAAREA[1]/SHOW_PO[1]/POHEADER[1]/of:U
SERAREA[1]/text()[8] -->
<Source
node="/msg[1]/req[1]/dta[1]/SHOW_PO_007[1]/DATAAREA[1]/SHOW_PO[1]/POHEADER[1
]/of:USERAREA[1]/of:TRANSMETHD[1]" line="77" mode="*default*">
<Instruction element="xsl:template"
line="20">
<Instruction element="xsl:copy"
line="21">
<Instruction
element="xsl:apply-templates" line="22">
To my understanding (being fairly new to XSL*) Saxon has identified the same
source path as I am using, or?
> 3) This one is working, but now I may match POLINE tags as well...
> <xsl:template match="//of:USERAREA/of:TRANSMETHD" mode="copy">
<<This template will only match of:TRANSMETHD elements that are children
<<of of:USREAREA elements, so I don't understand why you say that it
<<might match POLINE elements as well.
Well this is probably because you haven't seen the source document
structure.
There might be a POHEADER/of:USERAREA/of:TRANSMETHD and several
POLINE[1->n]/of:USERAREA/of:TRANSMETHD
Thanks for clarifying the // :)
Best regards Magnus
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list