|
Revision 1215, 1.3 kB
(checked in by thomase, 1 year ago)
|
two stylesheets whereby one of our KML point files can be rendered into a comma-delimited text file with x,y,label and pleiadesurl columns; first apply unescapekmldesc so that the kml2xy stylesheet can get at xhtml tags in the description; characters above us-ascii are converted to numeric entities; these text files have been tested with arcmap "add xy data" tool.
|
- Property svn:eol-style set to
native
|
| Line | |
|---|
| 1 |
<?xml version="1.0" encoding="UTF-8"?> |
|---|
| 2 |
<xsl:stylesheet |
|---|
| 3 |
xmlns="http://earth.google.com/kml/2.1" |
|---|
| 4 |
xmlns:kml="http://earth.google.com/kml/2.1" |
|---|
| 5 |
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> |
|---|
| 6 |
<xsl:output method="text" encoding="us-ascii" /> |
|---|
| 7 |
|
|---|
| 8 |
<xsl:template match="/"> |
|---|
| 9 |
<xsl:text></xsl:text>x,y,label,pleiadesurl<xsl:text> |
|---|
| 10 |
</xsl:text> |
|---|
| 11 |
<xsl:apply-templates select="//kml:Placemark"/> |
|---|
| 12 |
</xsl:template> |
|---|
| 13 |
|
|---|
| 14 |
<xsl:template match="kml:Placemark"> |
|---|
| 15 |
<xsl:variable name="urlp" select="descendant::kml:p[starts-with(., 'URL:')]"/> |
|---|
| 16 |
<xsl:variable name="url" select="$urlp/kml:a/@href"/> |
|---|
| 17 |
<xsl:variable name="coords" select="descendant::kml:Point/kml:coordinates"/> |
|---|
| 18 |
<xsl:variable name="xcoord" select="substring-before($coords, ',')"/> |
|---|
| 19 |
<xsl:variable name="ycoord" select="substring-before(substring-after($coords, ','), ',')"/> |
|---|
| 20 |
<xsl:text></xsl:text><xsl:value-of select="$xcoord"/>,<xsl:text></xsl:text> |
|---|
| 21 |
<xsl:text></xsl:text><xsl:value-of select="$ycoord"/>,<xsl:text></xsl:text> |
|---|
| 22 |
<xsl:text></xsl:text><xsl:value-of select="kml:name"/>,<xsl:text></xsl:text> |
|---|
| 23 |
<xsl:text></xsl:text><xsl:value-of select="$url"/><xsl:text> |
|---|
| 24 |
</xsl:text> |
|---|
| 25 |
</xsl:template> |
|---|
| 26 |
</xsl:stylesheet> |
|---|