Sorry, I masnipulated the original data for my sample!!
This one should be welformed:
<xsl:for-each select="LDL">
<xsl:for-each select="G2[1]/G502/(_1st_Name,_2nd_Name, _3nd_Name,_4nd_Name,
_5nd_Name)[. =('FF')]">
<Depot>
<xsl:value-of select="_3rd_Logical"/>
<xsl:value-of select="_1nd_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>
</xsl:for-each>
</xsl:for-each>
<LDL>
<G2>
<G502>
<_1st_Name>FF</_1st_Name>
<_2nd_Logical>MLBIE85</_2nd_Logical>
<_3rd_Name>FW</3rd_Name>
<_4th_Logical>FW</_4th_Logical>
<_3rd_Logical>ENMST01</_3rd_Logical>
<_5th_Logical>USPTR05</_5th_Logical>
</G502>
</G2>
<G2>
<G502>
<_1st_Name>FF</_1st_Name>
<_2nd_Logical>MLTILG5</_2nd_Logical>
<_3rd_Name>FW</3rd_Name>
<_4th_Logical>FW</_4th_Logical>
<_3rd_Logical>ENMOI8</_3rd_Logical>
<_5th_Logical>USKKTR04</_5th_Logical>
</G502>
</G2>
</LDL>
--- David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk> schrieb am Mo, 30.7.2012:
Von: David Carlisle <davidc(_at_)nag(_dot_)co(_dot_)uk>
Betreff: Re: [xsl] causal for each issue
An: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
CC: "henry human" <henry_human(_at_)yahoo(_dot_)de>
Datum: Montag, 30. Juli, 2012 20:59 Uhr
On 30/07/2012 19:53, henry human
wrote:
hi The result of following for-each statement is
<Depot/> and not as
exected. I could not find the mistake ! Here are the
XSLT and the XML
file :
<xsl:for-each select="LDL"> <xsl:for-each
select="G2[1]/G502/(1st_Name,2nd_Name,
3nd_Name,4nd_Name, 5nd_Name)[.
=('FF')]">
This is an xpath syntax error as you can not start element
names with
digits. had you used different names the filter .='FF' would
mean the
for-each was iterating over a single element the 1st_Name
element in the
first G2. That element only has text content ('FF') soo all
the
following value-of would select nothing as they are
selecting elements
(once they are fixed to use legal names)
<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>
</xsl:for-each> </xsl:for-each>
********************** <LDL> <G2>
<G502> <1st_Name>FF</1st_Name>
This is not well formed you can not start element names with
a digit.
This will be a fatal error and XSLT will not start.
<2nd_Logical>MLBIE85</2nd_Logical>
<3rd_Name>FW</3rd_Name>
<_4th_Logical>FW</_4th_Logical>
<3rd_Logical>ENMST01</3rd_Logical>
<5th_Logical>USPTR05</5th_Logical>
</G502> </G2> <G2> <G502>
<nd_Name>FF</2nd_Name>
<2nd_Logical>ATVIE85</2nd_Logical>
<2nd_KNTT_Flag>0</2nd_KNTT_Flag>
<3rd_Name>FW</3rd_Name>
<_4th_Logical>FW</_4th_Logical>
<3rd_Logical>DEHAM05</3rd_Logical>
</G502> </G2> </LDL>
brg henry
David
--~------------------------------------------------------------------
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>
--~--