[XSL-LIST Mailing List Archive Home]
[By Thread]
[By Date]
[xsl] template matching using namespace
Subject: [xsl] template matching using namespace
From: "Nima Kaviani" <nkaviani@xxxxxx>
Date: Tue, 28 Nov 2006 22:54:13 -0800
|
Hi list,
Once again your help with my 2 questions will be highly appreciated.
First, I have a template in which I only use the namespace to filter
out the elements. But based on the content I want to behave in
different ways inside the template. So, let's say I have the snippet
below
<constraint:SimpleConstraint rdf:ID="ph_student">
<constraint:subject rdf:resource="#var1"/>
<constraint:predicate rdf:resource="&rdf;type"/>
<constraint:object rdf:resource="&univ;PhD"/>
<policy:desc>PhD student</policy:desc>
</constraint:SimpleConstraint>
<constraint:And rdf:ID="andedConstraints">
<constraint:firstt rdf:resource="#isPhdStudent"/>
<constraint:second rdf:resource="#isLivingInOurLab"/>
</constraint:SimpleConstraint>
<constraint:SimpleConstraint rdf:ID="oredConstraints">
<constraint:firstt rdf:resource="#wasPhDStudent"/>
<constraint:second rdf:resource="#wasWorkingInOurLab"/>
</constraint:SimpleConstraint>
and the following template:
<xsl:template match="constraint:*">
<!-- some code -->
</xsl:template>
if I apply my template to the XML file above then it will catch all
the three elements. is there any way I can find out which one is
currently being caught by the current template that the program
counter is in?
I know I could have 3 different templates defined, with the element
names explicitly written, but then I have to have redundant code that
I prefer to avoid.
My second question, is there any way I can identify and copy those
parts of the code that have not been caught by any of the defined XSLT
template, to the output?
thanks a lot,
-Nima
|