Groups | Blog | Home
all groups > dotnet xml > august 2004 >

dotnet xml : Value-of Select


Paul King
8/26/2004 5:32:49 PM
Hi there,

Im in a pickle chaps. I need to fetch information out from our raw XML
files into a Style XSL sheet.

Basically I have the commant

<xsl:value-of select="Product/ProductCode"/>

However the structure of the XML file is based like the following example

<root>
<Product>
<ProductCode type="Seller">V1145</ProductCode>
<ProductCode type="Buyer">H05439</ProductCode>
</Product>
</root>

As you can see, we have different product codes based on Buyer and Sellers.
However in my style sheet I only want to see results from the Type="Seller".
This works to some degree, but if the XML file does not contain a Seller
code, the output automatically comes from the Buyer Code.

If I try to modify my value-of select statement to include "type="Seller""
then the style sheet will fail due to syntax etc.

Any help please.

Thanks
Paul

Marrow
8/26/2004 10:45:35 PM
Hi Paul,

Do you want something like?...

<xsl:value-of select="Product/ProductCode[@type = 'Seller']"/>

HTH
Marrow
http://www.marrowsoft.com - home of Xselerator (XSLT IDE and debugger)
http://www.topxml.com/Xselerator



[quoted text, click to view]

Paul King
8/27/2004 9:46:43 AM
Yep - got it thanks matey

:)


[quoted text, click to view]

AddThis Social Bookmark Button