Hi Craig:
To reiterate and summarize Ken's excellent advice, your solution
includes any or all of:
1. Variables - bind global variables to your respective trees and you
can always get from one to the other;
2. Tunnel parameters - a very powerful way of passing "context" or
"calling state" through a chain of templates (of arbitrary depth), so
there when you need it, e.g. recalling a 'home' node;
3. Keys - permit accessing arbitrary nodes across system boundaries
(including document boundaries), given any associations (value or
context-based) of interest.
Enjoy,
Wendell
On Wed, Jun 10, 2015 at 3:59 PM, Craig Sampson
craig(_dot_)sampson(_at_)sas(_dot_)com
<xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> wrote:
Hi All,
I am working on a transform that merges a second input (xml) file with the
primary input (xml) file to create one deliverable. I am accessing the
second input file using the doc() function.
Is there a way to look up from the second input file to see attribute
values in the first input file?
Here’s a snippet of the primary input file:
<refBody>
<refActionSet actionSet="cas.tkcastab" eid="p19uxflykz04i4n166yzdl1o5osr">
<exampleBlock eid="n1nw8ix56o1qx5n1t8woivgwje9g">
<example eid="p0pzu6eop12af6n1j7dnjo7ripkd">
Here’s a snippet of the second input file:
<actionSet id="cas.tkcastab" name="tkcastab" scriptname="tkcastab"
prmname="tkcastab">
<label id="cas.tkcastab.__label" key="TKCASTAB_LABEL_LIBRARY">Tables and
Files</label>
<action id="cas.tkcastab.view" name="view" entry="View">
<label id="cas.tkcastab.view.__label" key="TKCASTAB_LABEL_VIEW">Create
View</label>
<desc id="cas.tkcastab.view.__desc" key="TKCASTAB_DESC_VIEW">Define a
view from files or tables</desc>
When I am in the action template I want to get the exampleBlock’s eid value.
I get to the action when the refActionSet element in the primary input file
is being processed by its template. The template contains the following:
(note: the second file is in the “cas” namespace)
<xsl:variable name="myActionSet"
select="doc(concat('file:',translate($casFile,'\','/')))"/>
<xsl:apply-templates select="$myActionSet/cas:casActions"> <!-- in
xisActionSet.xsl -->
<xsl:with-param name="actionSetID" select="@actionSet"/>
</xsl:apply-templates>
I tried to get the exampleBlock eid value from the action template using:
<a href="{ancestor::refActionSet/exampleBlock/@eid}.htm">
But got nothing. If it isn’t possible (doc is a function after all) to look
up to the parent xml I can always pass the attribute value as a parameter
from the refActionSet template.
Thanks,
Craig
BTW I see the list in the digest view so I won’t see any responses till
tomorrow unless you include my email in your response to the list.
craig(_dot_)sampson(_at_)sas(_dot_)com
XSL-List info and archive
EasyUnsubscribe (by email)
--
Wendell Piez | http://www.wendellpiez.com
XML | XSLT | electronic publishing
Eat Your Vegetables
_____oo_________o_o___ooooo____ooooooo_^
--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--