I would like to extract everything between the <head> tag elements in an html page. Including link tags and script tags.
Assume the source code below is a snippet which would be part of a full html document.
The source:
...
<head>
<link rel="stylesheet" href="style.css"
type="text/css" media="handheld" />
<link rel="stylesheet" href="style.css"
type="text/css" media="handheld" />
<script type="text/javascript" src="main.js"></script>
<script type="text/javascript" src="second.js"></script>
</head>
...
XSLT:
<xsl:output method="xml" encoding="utf-8" indent="no"/>
<xsl:template match="/">
<xsl:copy-of select="link"/>
</xsl:template>
This works fine if there is only one tag I'm trying to get. Is there a way I can process everything and only everything between the "head" tags.
The output I expect would be:
<link rel="stylesheet" href="style.css"
type="text/css" media="handheld" />
<link rel="stylesheet" href="style.css"
type="text/css" media="handheld" />
<script type="text/javascript" src="main.js"></script>
<script type="text/javascript" src="second.js"></script>