CS257
Chris Pollett
Feb 5, 2024
<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="xslplane.xsl" ?>
<plane>
<year>1970</year>
</plane>
<?xml-stylesheet type="text/xsl" href="xslplane.xsl" ?>is where we are associating a stylesheet with the XML document (you can also associate CSS, Cascading StyleSheets if you like).
<?xml version="1.0" encoding="utf-8" ?>
<xsl:stylesheet version="1.0"
xmlns:xsl= "http://www.w3.org/1999/XSL/Transform"
xmlns = "http://www.w3.org/1999/xhtml"
>
<xsl:template match="plane">
<html><head>
<title>result of applying a stylesheet to plane</title>
</head><body><h1>Plane Description</h1>
<xsl:apply-templates />
</body></html>
</xsl:template>
<xsl:template match="year">
<p style="color:red">
<xsl:value-of select="." />
</p>
</xsl:template>
</xsl:stylesheet>
doc("winecellar.xml")/winecellar/wine
matches all wine nodes (and their contents) in the winecellar.xml file which start from the whole document,
then immediately go through a winecellar sub-tag then have a wine tag.
doc("winecellar.xml")/winecellar/wine[2]
doc("winecellar.xml")/winecellar/wine[price > 20]/name
returns the names of all wine nodes with price attribute greater than 20.
URL: https://apnews.com/apf-topnews Channel: //article[contains(@class, 'feed')] Item Separator: //div[contains(@class, 'FeedCard')] Title: //div[contains(@class, 'CardHeadline')]//h1 Description: //div[contains(@class, 'content')] Link: //a[contains(@data-key, 'story-link')]
Which of the following is true?
<wine> <name>Meghhetti White</name> <year>2010e</year> </wine>would be represented by the figure above.
start document start element: wine start element: name text: Meneghetti end element: name start element: year text: 2010 end element: year end element: wine end document