I have a for each loop on my xslt file, which will go and process multiple Conditions, If any of the conditions have a matching scenario than I want to exit out of the loop and give the first value(which has satisfied the condition) for my output.
Here is my xml file
<Product> <ContactDetails> <addressdetail> <Street>Stack</Street> <HouseNumber>123</HouseNumber> </addressdetail> <addressdetail> <Street>Stack</Street> <HouseNumber>123456</HouseNumber> </addressdetail> <addressdetail> <Street>Stack</Street> <HouseNumber>456</HouseNumber> </addressdetail> </ContactDetails> </Product> and in my XSL file i have some kinding like this
<xsl:for-each select ="Product[ContactDetails= 'addressdetails'] "> <xsl:if test="Street='Stack'" > <p3:SC>abc</p3:SC> </xsl:if> </xsl:for-each> After the transformation, I am having three values on my output xml
<p1:Product_Req> <p2:ContactDetails_Req> <p3:ac>abc</p3:ac> <p3:ac>abc</p3:ac> <p3:ac>abc</p3:ac> </p1:Product_Req> </p2:ContactDetails_Req> But I dont need the repeting values on my output xml, I only need one value on my Xml node ac. I have tried using the identity transform but nothing seems like working, any help is highly appreciated
No comments:
Post a Comment