XSLT fiiltering

SANbuddies
SANbuddies used Ask the Experts™
on
I am running xslt and observed that there are two occurance of the attribute but the xslt is only fetching one occurance. I am not sure on what basis the xslt is retrieving on occurance and skipping the other.
Can someone explain?

I have modified the input file so there might be some syntax erro.

input file is
<Container>
<SPXTagCable>
<IObject  Name="26 C05110" />
 <Rel>      
      <IRel DefUID="CableFromTag" />
      <IObject UID="2e56510a-f578-4dfd-a1a9-515e6e60d92b" />
      <SPXTagFireGas>
        <IObject Name="43 FABU0A-01612B"  />
        </SPXTagFireGas>
</Rel>
</SPXTagCable>

 <SPXTagFireGas>
  <Rel>
      <ISubmittedItem TerminateObjectFlag="False" SAPInsertUpdateFlag="" />
      <IRel DefUID="CableFromTag" />
      <IObject UID="2e56510a-f578-4dfd-a1a9-515e6e60d92b" />
      <SPXTagCable>
        <IObject  Name="26 C05110" />
        </SPXTagCable>                
  </Rel>
 </SPXTagFireGas>
 </Container>

for some reason xslt is retreiving the following one but skipping the other.
<SPXTagFireGas>
  <Rel>
      <ISubmittedItem TerminateObjectFlag="False" SAPInsertUpdateFlag="" />
      <IRel DefUID="CableFromTag" />
      <IObject UID="2e56510a-f578-4dfd-a1a9-515e6e60d92b" />
      <SPXTagCable>
        <IObject  Name="26 C05110" />
        </SPXTagCable>                
  </Rel>
 </SPXTagFireGas>
input.xml
xslt-code.txt
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
well, you broke the code by making up the XML

the container template has a apply templates for this
*[ITaggedItem]/Rel
none of the Rel has a sibling ITaggedItem, so in this example none will be selected

I am suspicious, maybe in your real XML, one Rel has a sibling ITaggedItem
and the other has not?
Can we see more of the original XML? Or can you check the ITaggedItem being there in the two Rel?

If you post examples, and you make up the XML, please make sure they at least reproduce the problem

Author

Commented:
Yes it was wrong I have attached the original input file.
The one which is being skipped has more than one occurrance of ITaggedItem.
you can see in the input file.
Is this the answer?
second, let suppose if in both tags the ITaggedItem item occurance is more than once than what will the result?
input.xml
Information Architect
Top Expert 2006
Commented:
OK, the template
   <xsl:template match="*[ITaggedItem]/Rel">
is triggered 15 times with this XML

7 times for the <SPXTagJunctionBox/>
and 8 times for the <SPXTagCable/>

this when branch gets triggered twice
                <xsl:choose>
                    <xsl:when test="$DefUID='CableFromTag'">
                    </xsl:when>
                   
                </xsl:choose>

once for the <SPXTagJunctionBox/>
and once for the <SPXTagCable/>          

so I am not sure what problem you are experiencing, but it must be due to what you had inside the when clause
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Author

Commented:
I have to send you the big input file for some reason I can't upload the xml from my office Network I will try to upload it from home later.

thanks
Gertone (Geert Bormans)Information Architect
Top Expert 2006

Commented:
OK, will see that later
cheers

Author

Commented:
I will post the question tomorrow, just the code and data set is here because for some reason I can't upload the file from my office network.

thanks
input-VTLJob.1602-PL-EKOL.xml-Re.xml
N-N-TagsToSPO-Operations-QL10-.txt

Author

Commented:
hi after a long long time I found the problem it was based on the filtering the select I had was  <xsl:template match="*[ITaggedItem]/Rel">
and it was filtering correctly and showing what it should.

thanks for your help

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial