Hey guys,
I'm currently studying XPATH and i think im getting confused with these topics.
I have my XML document set up, also a XSL style sheet.
eg.
e.g
What i am confused with what is XPATH and what does it do?
And also since in my XSL i have searched for the name of the attribute with AUS but i have two how do i show both of them?
Thanks and my questioning may be confusing but and feedback would be good. Thanks
I'm currently studying XPATH and i think im getting confused with these topics.
I have my XML document set up, also a XSL style sheet.
eg.
Code:
XML document <?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/xsl" href="po.xsl"?> <listOfOrders> <purchaseOrder orderDate="1999-10-20"> <shipTo country="AU"> <name>Alice Smith</name> <street>123 Maple Street</street> <city>Mill Valley</city> <state>CA</state> <zip>90952</zip> </shipTo> <billTo country="AU"> <name>Robert Smith</name> <street>8 Oak Avenue</street> <city>Old Town</city> <state>PA</state> <zip>95819</zip> </billTo> <comment>Hurry, my lawn is going wild!</comment> <items> <item partNum="872-AA"> <productName>Lawnmower</productName> <quantity>1</quantity> <USPrice>148.95</USPrice> <comment>Confirm this is electric</comment> </item> <item partNum="926-AA"> <productName>Baby Monitor</productName> <quantity>1</quantity> <USPrice>39.98</USPrice> <shipDate>1999-05-21</shipDate> </item> </items> </purchaseOrder> <purchaseOrder orderDate="2005-08-17"> <shipTo country="AU"> <name>Anne Other</name> <street>321 Baker Street</street> <city>Toowoomba</city> <state>QLD</state> <zip>4350</zip> </shipTo> <billTo country="AU"> <name>Jan Janssens</name> <street>Parklaan 7</street> <city>Antwerp</city> <zip>2050</zip> </billTo> <comment>Please don't send me the bill</comment> <items> <item partNum="BC-249"> <productName>Television</productName> <quantity>1</quantity> <USPrice>100.00</USPrice> <comment>Does it have teletext?</comment> </item> <item partNum="XYW"> <productName>Bottle opener</productName> <quantity>1</quantity> <USPrice>2.50</USPrice> <shipDate>2005-08-21</shipDate> </item> </items> </purchaseOrder> <purchaseOrder orderDate="2004-09-01"> <shipTo country="AU"> <name>Anne Other</name> <street>321 Baker Street</street> <city>Toowoomba</city> <state>QLD</state> <zip>4350</zip> </shipTo> <billTo country="AU"> <name>Anne Other</name> <street>321 Baker Street</street> <city>Toowoomba</city> <state>QLD</state> <zip>4350</zip> </billTo> <comment></comment> <items> <item partNum="BC-249"> <productName>Television</productName> <quantity>1</quantity> <USPrice>100.00</USPrice> <comment>Does it have teletext?</comment> </item> <item partNum="XYW"> <productName>Bottle opener</productName> <quantity>1</quantity> <USPrice>2.50</USPrice> <shipDate>2004-09-10</shipDate> </item> <item partNum="YCK88"> <productName>DVD+R Media</productName> <quantity>20</quantity> <USPrice>1.20</USPrice> <shipDate>2004-09-15</shipDate> </item> </items> </purchaseOrder> </listOfOrders>
Code:
XSL document <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <html> <body> <h3>Select the date of the purchase order if it is shipped to Australia:</h3> <xsl:value-of select="//purchaseOrder[.//@country='AU']//name"/><br /> <xsl:value-of select="//purchaseOrder[.//@country='AU']//street"/><br /> </body> </html> </xsl:template> </xsl:stylesheet>
And also since in my XSL i have searched for the name of the attribute with AUS but i have two how do i show both of them?
Thanks and my questioning may be confusing but and feedback would be good. Thanks
Comment