[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Question about isolating records

Subject: Re: [xsl] Question about isolating records
From: "G. Ken Holman g.ken.holman@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Sun, 6 Sep 2015 12:44:31 -0000

At 2015-09-06 03:48 +0000, Mark Wilson pubs@xxxxxxxxxxxx wrote:
I got to work with one small change to your suggested code:

<xsl:attribute name="pdf-number" select="substring-before(key('pdf-key', ., doc('test-xml.xml')), 'Crawford')"/>

I think a better solution would be:

 <xsl:attribute name="pdf-number"

... because you want the value of the <PDF> child of the <Item> element being returned by the key() function. I worry you approach XSLT, like many of my incoming students did, as dealing with XML as a bunch of strings to be manipulated. I had to teach the students to understand XSLT treats XML as a bunch of nodes, not strings. Whereas you approached the solution above by substringing the <Item> element string value, I suggest you simply address the PDF child of the Item element node and you have everything you need without using substrings.

My major misunderstanding was of the <xsl:key/> statement, not realizing that is was not a 'variable to be loaded when called' and that the key() function later would parse the data in FILE2.

Good ... I was trying to get across to you that, yes, the key declaration is in effect for all input files.

Also, thanks for reopening the book for me.

You are most welcome. Other registered purchasers are welcome to ask for access to the latest edition (14th, dated 2011-02-11).

. . . . . . Ken

Check our site for free XML, XSLT, XSL-FO and UBL developer resources |
Free 5-hour lecture:  http://www.CraneSoftwrights.com/links/video.htm |
Crane Softwrights Ltd.             http://www.CraneSoftwrights.com/s/ |
G. Ken Holman                    mailto:gkholman@xxxxxxxxxxxxxxxxxxxx |
Google+ profile:       http://plus.google.com/+GKenHolman-Crane/about |
Legal business disclaimers:     http://www.CraneSoftwrights.com/legal |

--- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus

Current Thread