David,
I may have misinterpreted what you wanted.
I thought you wanted to build a dynamic select statement based on the values
provided in the lookup xml. The way to do that is to use the predicate part of
the xpath to "filter" the desired result sequence to be processed by your
templates. XPath predicates are indicated by [] in the expression.
However, it looks like you want to rename some elements dynamically based on
some LRLookUp1 xml. I was confused by the LR--LookUp--1.
So the following xml
<LRLookUp1>
<Element from="LR/Name" to="Name"/>
<Element from="LR/City" to="HomeTown"/>
</LRLookUp1>
Says translate <LR><City>Boston</City></LR> into <HomeTown>Boston</HomeTown>
and translate <LR><Name>David</Name></LR> into <Name>David</Name>. Right?
So you might accomplish that this way:
<xsl:variable name="lookup" select="document(<uri>)"/>
<xsl:template match="LR/Name">
<xsl:element name="$lookup/Element[(_at_)from='LR/Name']/@to">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
<xsl:template match="LR/City">
<xsl:element name="$lookup/Element[(_at_)from='LR/City']/@to">
<xsl:value-of select="."/>
</xsl:element>
</xsl:template>
Hope that helps.
Douglas Ross
Developer, HTML UI Framework
Kronos
-----Original Message-----
From: David Laub [mailto:dlaub(_at_)prodigy(_dot_)net]
Sent: Saturday, March 12, 2005 3:16 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Re: xsl-list Digest 12 Mar 2005 06:10:01 -0000 Issue 354 -
Thanks for help, but still stuck!
I apologize for my stupidy on many levels:
1) mis-spelling Data-Driven as Data-Dtriven
2) The copy & paste from XMLSpy stuck the irrelevant
chars "3D" all over the place
3) not really getting your solution - your solution
seems to depend on the LR.XML file having elements
with a from attribute - these elements don't have
attributes. So, I'm still stuck!
Thanks - even if you can no longer spare any time for
a newbie!
David Laub
LR.xml
<LR>
<Name>David Laub</Name>
<Age>53</Age>
<Addr>4645 W. Jerome</Addr>
<Telephone>847-674 2266</Telephone>
<City>Skokie</City>
<State>IL</State>
</LR>
LRLookup1.xml
<LRLookUp1>
<Element from="LR/Name" to="Name"/>
<Element from="LR/City" to="HomeTown"/>
</LRLookUp1>
GenericLRFilter.xsl
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:output method="xml" indent="yes"/>
<xsl:variable name="LossReport"
select="document('XSLT/LR.xml')"/>
<xsl:template match="*">
<xsl:element name="LRFilteredData">
<xsl:apply-templates/>
</xsl:element>
</xsl:template>
<xsl:template match="/LRLookUp1/Element">
<xsl:element name="{./@to}">
<xsl:value-of select="$LossReport/LR[./@from]"/>
</xsl:element>
<xsl:apply-templates/>
</xsl:template>
</xsl:stylesheet>
actual results:
<LRFilteredData>
<Name></Name>
<HomeTown></HomeTown>
</LRFilteredData>
desired results:
<LRFilteredData>
<Name>David Laub</Name>
<HomeTown>Skokie</HomeTown>
</LRFilteredData>
--- xsl-list-digest-help(_at_)lists(_dot_)mulberrytech(_dot_)com wrote:
xsl-list Digest 12 Mar 2005 06:10:01 -0000 Issue 354
Topics (messages 13289 through 13346):
Re: Variables and HTML
13289 by: Michael Kay
13291 by: David Carlisle
13292 by: David Carlisle
13298 by: Pieter Reint Siegers Kort
13317 by: David Carlisle
13321 by: Pieter Reint Siegers Kort
13322 by: Pieter Reint Siegers Kort
13324 by: Carmelo Montanez
13325 by: Michael Kay
13327 by: Pieter Reint Siegers Kort
13340 by: Nathan Young
13341 by: Wendell Piez
13342 by: David Carlisle
Re: XSLT 2.0 function - fastest node comparison
13290 by: Dimitre Novatchev
Re: FO cross references
13293 by: Elena Pierazzo
13299 by: Markus Abt
13310 by: Elena Pierazzo
13334 by: Markus Abt
13336 by: J.Pietschmann
Re: calling two consecutive xsl files
13294 by: JBryant.s-s-t.com
sorting - lost in a maze
13295 by: Jason Trépanier
13301 by: cknell.onebox.com
13303 by: Touchtel
13308 by: Michael Kay
13311 by: Touchtel
method of converting xml string to xml nodes
13296 by: Majirus FANSI
13297 by: Ross, Douglas
13307 by: Majirus FANSI
13312 by: Colin Paul Adams
13335 by: J.Pietschmann
Newbie issue with apply-templates and output
13300 by: A.Little
13302 by: Ross, Douglas
13304 by: Touchtel
13305 by: A.Little
13306 by: Majirus FANSI
13313 by: Wendell Piez
Get the XML File name in XSL?
13309 by: c p
Re: current-group () function trouble
13314 by: Kessler, Marcy
CDATA help
13315 by: Midsummer Sun
13316 by: David Carlisle
13320 by: Midsummer Sun
String to integer conversion
13318 by: babu.eshwaramoorthy.wipro.com
13323 by: Michael Kay
Copying and inserting nodes on a tree
13319 by: António Mota
XSLT 1 and 2 differences (d-o-e and namespaces)
13326 by: Midsummer Sun
13328 by: Pieter Reint Siegers Kort
13329 by: Midsummer Sun
13330 by: M. David Peterson
13331 by: Michael Kay
13332 by: Michael Kay
13344 by: Midsummer Sun
Selecting vs matching text() elements and the
default template
13333 by: Ross, Douglas
13337 by: Wendell Piez
right padding with zeros
13338 by: Bhaskar, Rajan
13339 by: Michael Kay
Data-Dtriven node selection
13343 by: David Laub
13345 by: Ross, Douglas
13346 by: Ross, Douglas
Administrivia:
To subscribe to the digest, e-mail:
<xsl-list-digest-subscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
To unsubscribe from the digest, e-mail:
<xsl-list-digest-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
To post to the list, e-mail:
<xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
----------------------------------------------------------------------
Date: Fri, 11 Mar 2005 09:10:04 -0000
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
From: "Michael Kay" <mike(_at_)saxonica(_dot_)com>
Subject: RE: [xsl] Variables and HTML
Why will d-o-e be deprecated in XSLT 2.0 when
there are valid
use cases for
it?
I think the simplest answer to that is: because it's
an architectural
abomination; it requires extensions to the data
model that are difficult to
specify and expensive to implement; it can only be
made to work in special
cases where the transformer and the serializer are
very closely coupled, and
that's something we don't want to encourage.
But when you ask for the reasons why a working group
made a particular
decision, you might find that different people give
you different answers.
Michael Kay
http://www.saxonica.com/
------------------------------
Date: Fri, 11 Mar 2005 09:57:22 GMT
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk>
Subject: Re: [xsl] Variables and HTML
Message-Id:
<200503110957(_dot_)JAA26721(_at_)penguin(_dot_)nag(_dot_)co(_dot_)uk>
In addition to Michael's reasons, there is also the
fact that 2.0 has
character maps that can be used for many of the
things that d-o-e is
used for in a slightly less disruptivew ay
architecturally.
David
________________________________________________________________________
This e-mail has been scanned for all viruses by
Star. The
service is powered by MessageLabs. For more
information on a proactive
anti-virus service working around the clock, around
the globe, visit:
http://www.star.net.uk
________________________________________________________________________
------------------------------
Date: Fri, 11 Mar 2005 10:18:54 GMT
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
From: David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk>
Subject: Re: [xsl] Variables and HTML
Message-Id:
<200503111018(_dot_)KAA26839(_at_)penguin(_dot_)nag(_dot_)co(_dot_)uk>
I wrote
In addition to Michael's reasons, there is also
the fact that 2.0 has
character maps that can be used for many of the
things that d-o-e is
used for in a slightly less disruptive way
architecturally.
David
To expand on that, one of the problems with d-o-e is
that you can go
<xsl:value-of select="'<br>'"/>
<xsl:value-of disable-output-escaping="yes"
select="'<br>'"/>
and the model is that that puts something into the
result tree which
when linearised at the end of the process produces
<br><br>
The trouble is that, as specified, there isn't
really anything that can
=== message truncated ===
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--