EDN Admin
Well-known member
Hi all,
I am trying to get my head around a tricky scenario where I have a NodeSet buried in my source XML, who themselves reside within NodeSets, and I need the inner mapped nodesets to make uses of elements that reside in their direct ancestor nodeset.
Firstly, my source XML is as follows...
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; protests<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; dettaglioProtesti<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; soggetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >GRANDMOTHER NAME<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; soggetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; elencoProtestiCerti<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; protesti<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prSoggetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; key<span style="color:Blue; >7443<span style="color:Blue; </<span style="color:#A31515; key<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >TO BE ACCESSD BY prElencoDatiREPR/prDatiREPR (below @num = 1,2)<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prSoggetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prElencoDatiREPR<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prDatiREPR <span style="color:Red; num<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 1<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prInfoEffetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prTipoEffetto<span style="color:Blue; >TYPE<span style="color:Blue; </<span style="color:#A31515; prTipoEffetto<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prInfoEffetto<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prDatiREPR<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prDatiREPR <span style="color:Red; num<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 2<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prInfoEffetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prTipoEffetto<span style="color:Blue; >TYPE<span style="color:Blue; </<span style="color:#A31515; prTipoEffetto<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prInfoEffetto<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prDatiREPR<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prElencoDatiREPR<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; protesti<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; protesti<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prSoggetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; key<span style="color:Blue; >7447<span style="color:Blue; </<span style="color:#A31515; key<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >TO BE ACCESSD BY prElencoDatiREPR/prDatiREPR (below @num = 3,4)<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prSoggetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prElencoDatiREPR<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prDatiREPR <span style="color:Red; num<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 3<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prInfoEffetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prTipoEffetto<span style="color:Blue; >TYPE<span style="color:Blue; </<span style="color:#A31515; prTipoEffetto<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prInfoEffetto<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prDatiREPR<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prDatiREPR <span style="color:Red; num<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prInfoEffetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prTipoEffetto<span style="color:Blue; >TYPE<span style="color:Blue; </<span style="color:#A31515; prTipoEffetto<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prInfoEffetto<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prDatiREPR<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prElencoDatiREPR<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; protesti<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; elencoProtestiCerti<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; dettaglioProtesti<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; protests<span style="color:Blue; >
[/code]
<br/>
What I want to do is from within the inner nodeset for each mapped node (prDatiREPR) I need to access elements that are a direct ancestor to the current mapped node (prSoggetto).
The template I currently have is as follows...
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; template <span style="color:Red; match<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; prDatiREPR<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Name<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; apply-templates <span style="color:Red; select<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ../../../protesti/prSoggetto/name<span style="color:Black; " <span style="color:Red; mode<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; NameHander<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; Name<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; template<span style="color:Blue; >
[/code]
which is called using the following XSLT statement...
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; apply-templates <span style="color:Red; select<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; protests/dettaglioProtesti/elencoProtestiCerti/protesti/prElencoDatiREPR/prDatiREPR<span style="color:Black; " <span style="color:Blue; />
[/code]
<br/>
The problem I have is that when the following is called from within the template it maps to all <prSoggetto> elements, which is not what I want to do. I only need to map to the one <prSoggetto> who happens to be the ancestor of the <prDatiREPR>
node that is being mapped.
<xsl:apply-templates select="../../../protesti/prSoggetto/name" mode="NameHander" />
Is there a way I can access the information I need?
Thanks in advance - if I havent explained my problem scenario well enough please let me know what to expand on. <hr class="sig Tryst
View the full article
I am trying to get my head around a tricky scenario where I have a NodeSet buried in my source XML, who themselves reside within NodeSets, and I need the inner mapped nodesets to make uses of elements that reside in their direct ancestor nodeset.
Firstly, my source XML is as follows...
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; protests<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; dettaglioProtesti<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; soggetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >GRANDMOTHER NAME<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; soggetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; elencoProtestiCerti<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; protesti<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prSoggetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; key<span style="color:Blue; >7443<span style="color:Blue; </<span style="color:#A31515; key<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >TO BE ACCESSD BY prElencoDatiREPR/prDatiREPR (below @num = 1,2)<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prSoggetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prElencoDatiREPR<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prDatiREPR <span style="color:Red; num<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 1<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prInfoEffetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prTipoEffetto<span style="color:Blue; >TYPE<span style="color:Blue; </<span style="color:#A31515; prTipoEffetto<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prInfoEffetto<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prDatiREPR<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prDatiREPR <span style="color:Red; num<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 2<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prInfoEffetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prTipoEffetto<span style="color:Blue; >TYPE<span style="color:Blue; </<span style="color:#A31515; prTipoEffetto<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prInfoEffetto<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prDatiREPR<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prElencoDatiREPR<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; protesti<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; protesti<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prSoggetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; key<span style="color:Blue; >7447<span style="color:Blue; </<span style="color:#A31515; key<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; name<span style="color:Blue; >TO BE ACCESSD BY prElencoDatiREPR/prDatiREPR (below @num = 3,4)<span style="color:Blue; </<span style="color:#A31515; name<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prSoggetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prElencoDatiREPR<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prDatiREPR <span style="color:Red; num<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 3<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prInfoEffetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prTipoEffetto<span style="color:Blue; >TYPE<span style="color:Blue; </<span style="color:#A31515; prTipoEffetto<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prInfoEffetto<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prDatiREPR<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prDatiREPR <span style="color:Red; num<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; 4<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prInfoEffetto<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; prTipoEffetto<span style="color:Blue; >TYPE<span style="color:Blue; </<span style="color:#A31515; prTipoEffetto<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prInfoEffetto<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prDatiREPR<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; prElencoDatiREPR<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; protesti<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; elencoProtestiCerti<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; dettaglioProtesti<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; protests<span style="color:Blue; >
[/code]
<br/>
What I want to do is from within the inner nodeset for each mapped node (prDatiREPR) I need to access elements that are a direct ancestor to the current mapped node (prSoggetto).
The template I currently have is as follows...
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; template <span style="color:Red; match<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; prDatiREPR<span style="color:Black; "<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; Name<span style="color:Blue; >
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; apply-templates <span style="color:Red; select<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; ../../../protesti/prSoggetto/name<span style="color:Black; " <span style="color:Red; mode<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; NameHander<span style="color:Black; " <span style="color:Blue; />
<span style="color:Blue; </<span style="color:#A31515; Name<span style="color:Blue; >
<span style="color:Blue; </<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; template<span style="color:Blue; >
[/code]
which is called using the following XSLT statement...
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; <<span style="color:#A31515; xsl<span style="color:Blue; :<span style="color:#A31515; apply-templates <span style="color:Red; select<span style="color:Blue; =<span style="color:Black; "<span style="color:Blue; protests/dettaglioProtesti/elencoProtestiCerti/protesti/prElencoDatiREPR/prDatiREPR<span style="color:Black; " <span style="color:Blue; />
[/code]
<br/>
The problem I have is that when the following is called from within the template it maps to all <prSoggetto> elements, which is not what I want to do. I only need to map to the one <prSoggetto> who happens to be the ancestor of the <prDatiREPR>
node that is being mapped.
<xsl:apply-templates select="../../../protesti/prSoggetto/name" mode="NameHander" />
Is there a way I can access the information I need?
Thanks in advance - if I havent explained my problem scenario well enough please let me know what to expand on. <hr class="sig Tryst
View the full article