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

Re: [xsl] causal for each issue


Subject: Re: [xsl] causal for each issue
From: Michael Kay <mike@xxxxxxxxxxxx>
Date: Tue, 31 Jul 2012 09:15:02 +0100

On 31/07/2012 07:17, henry human wrote:
The problem is that the
current node, as per the provided source XML document, doesn't have
any element-children...
But currrent node is the <G502>element and this node has element childern as per definition in the XML?

The node you are selecting is not a G502 element. To simplify your code, when you write


G2[1]/G502/(A, B)[. =('FF')]">

the node you are selecting is an A or B element, not a G502 element. If you want to select the G502 element you should write

G2[1]/G502[(A, B) = 'FF']">

Think of A/B/C[P] as meaning "select A/B/C where P" - so the result is a set of C elements, the last step in the path.


Michael Kay Saxonica


brg
henry

--- Dimitre Novatchev <dnovatchev@xxxxxxxxx> schrieb am Di, 31.7.2012:

Von: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Betreff: Re: [xsl] causal for each issue
An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Datum: Dienstag, 31. Juli, 2012 00:45 Uhr
On Mon, Jul 30, 2012 at 1:54 PM,
henry human <henry_human@xxxxxxxx>
wrote:
must any of them(_1st_Name,_2nd_Name,
_3nd_Name,_4nd_Name, _5nd_Name) have a childern,why!!!!!!!?

Because this is what is specified in your code:

The current node (as specified in the select attribute of
<xsl:for-each>) is an:

    G2[1]/G502/(1st_Name,2nd_Name,
3nd_Name,4nd_Name, 5nd_Name)[. =('FF')]">

That is, the current node is an element having a name among
those
(ignoring the naming errors that you probably have already
fixed):

1st_Name,2nd_Name, 3nd_Name,4nd_Name, 5nd_Name

Then having one of these as the current node you have:

<Depot>
<xsl:value-of select="3rd_Logical"/>
<xsl:value-of select="2nd_Logical"/>
<xsl:value-of select="3rd_Logical"/>
<xsl:value-of select="4th_Logical"/>
<xsl:value-of select="5th_Logical"/>
<xsl:value-of select="6th_Logical"/>
</Depot>

That is, you want to output in the body of <Depot> the
string values
of all these *children* of the current node. The problem is
that the
current node, as per the provided source XML document,
doesn't have
any element-children, therefore nothing gets output. This is
exactly
the reported result and it is very obvious ans easy to
explain.


--- Dimitre Novatchev <dnovatchev@xxxxxxxxx>
schrieb am Mo, 30.7.2012:
Von: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Betreff: Re: [xsl] causal for each issue
An: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Datum: Montag, 30. Juli, 2012 22:05 Uhr
On Mon, Jul 30, 2012 at 12:21 PM,
henry human <henry_human@xxxxxxxx>
wrote:
_1st_Name,_2nd_Name, _3nd_Name,_4nd_Name,
_5nd_Name
None of the elements _1st_Name,_2nd_Name,
_3nd_Name,_4nd_Name,
_5nd_Name has any element children, therefore the
body of
the
generated literal result element depot is empty.




-- Cheers, Dimitre Novatchev --------------------------------------- Truly great madness cannot be achieved without
significant
intelligence.
---------------------------------------
To invent, you need a good imagination and a pile
of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make
mistakes may be
the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is
looking.
-------------------------------------
You've achieved success in your field when you
don't know
whether what
you're doing is work or play
-------------------------------------
Facts do not cease to exist because they are
ignored.
-------------------------------------
I finally figured out the only reason to be alive
is to
enjoy it.



--
Cheers,
Dimitre Novatchev
---------------------------------------
Truly great madness cannot be achieved without significant
intelligence.
---------------------------------------
To invent, you need a good imagination and a pile of junk
-------------------------------------
Never fight an inanimate object
-------------------------------------
To avoid situations in which you might make mistakes may be
the
biggest mistake of all
------------------------------------
Quality means doing it right when no one is looking.
-------------------------------------
You've achieved success in your field when you don't know
whether what
you're doing is work or play
-------------------------------------
Facts do not cease to exist because they are ignored.
-------------------------------------
I finally figured out the only reason to be alive is to
enjoy it.


Current Thread
Keywords
xml