RE: [xsl] generating id by calling template but how to use it at other places

Subject: RE: [xsl] generating id by calling template but how to use it at other places
From: "Roger Glover" <glover_roger@xxxxxxxxx>
Date: Thu, 6 Feb 2003 22:10:50 -0600
Jinesh Varia wrote:

> Are you some kind of XML jini!

Far from it.  Just ask the *real* regulars. :-)

> thank you very much. I am entangled in this XSL
> programming since two weeks and you solved it like in
> a blink.

You were most of the way there, you just needed one key insight.  It would
have taken me somewhat longer to write this starting with just an idea.

> But there are some serious issues here:
> With your approach of generating perids before the
> actual seperation of publication, person, pubper
> elements, I feel it would not work when I have 500,000
> author elements. I have an 130MB XML sheet which
> contains almost 350,000 publication elements
> I know you did not knew about this. Can you please
> comment on this.
> Do you think I am right on this? Please correct me.

I chose this solution not because it was the most efficient, but because it
was the most direct route I could find from where you were to where you
wanted to be.

Right now it would probably behoove you to spend some time with the FAQ, the
spec and other reference resources (I like Michael Kay's "XSLT Programmer's
Reference"), studying the syntax and usage of the "<xsl:key>" element and
the "key()" function.  You should then also look up and study any FAQ
reference to Muenchian grouping.

> Now there are also editors along with authors. Authors
> can be editors also for some publication. means
> <author>Steve Lawyer</author> for pub1 can be
> <editor>Steve Lawyer</editor> for pub2. but we want
> to have single person element generated. While in
> <pubper> we have <persontype> (1 for author, 2 for
> editors) hence in our example for pub1, it shoud be
> <persontype>1</persontype> and for pub2 it should be
> <persontype>2</persontype>
> how can we store that information with your code then?
> we have to get unique person names

Match "author | editor" instead of just "author", and use either "<xsl:if>"
or "<xsl:choose>" + "<xsl:when>" to choose between persontype "1" (author)
and persontype "2" (editor).  Likewise, the "select" expression on
"<xsl:apply-templates>" in the "persons" variable *would* have to become
much more complicated.  However, if you change to keys and Muenchian
grouping, the expression will be much simpler.

> You dont have a clue How much your code has helped
> me!!! I have been working on this since two weeks...
> thanks, roger. thank you

You are very welcome.  Glad to help.  :^)

Let us know if you get stuck, or when you have a final version.

-- Roger Glover

 XSL-List info and archive:

Current Thread