문화유산:장소지도.xsl: 두 판 사이의 차이
편집 요약 없음 |
편집 요약 없음 |
||
| 1번째 줄: | 1번째 줄: | ||
<?xml version="1.0" encoding="UTF-8"?> | |||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | |||
<xsl:template match="/"> | |||
<html> | |||
<head> | |||
<meta charset="UTF-8"/> | |||
<title>문화유산:장소지도</title> | |||
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css"/> | |||
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script> | |||
<style> | |||
.place-table { width: 100%; border-collapse: collapse; font-family: "Malgun Gothic", serif; } | |||
.place-table td { border: 1px solid #aaa; padding: 15px; text-align: left; } | |||
.place-table th { border: 1px solid #aaa; padding: 15px; background-color: #e8f0f7; color: #2c3e50; text-align: center; } | |||
</style> | |||
</head> | |||
<body> | |||
<table class="place-table"> | |||
<tr> | |||
<th width="10%">명칭</th> | |||
<th width="10%">주소</th> | |||
<th width="10%">건립</th> | |||
<th width="70%">설명</th> | |||
</tr> | |||
<xsl:for-each select="/place_list/place"> | |||
<tr> | |||
<td> <!--명칭--> | |||
<xsl:value-of select="name/korean"/><br/> | |||
<xsl:value-of select="name/hanja"/><br/> | |||
<xsl:value-of select="name/english"/><br/> | |||
</td> | |||
<td> <!--주소--> | |||
<xsl:value-of select="address"/> | |||
<!-- | |||
<xsl:value-of select="coordinates/latitude"/><br/> | |||
<xsl:value-of select="coordinates/longitude"/><br/> | |||
<xsl:value-of select="coordinates/altitude"/><br/> | |||
--> | |||
</td> | |||
<td> <!--건립--> | |||
<xsl:value-of select="established/year"/><br/> | |||
<xsl:value-of select="established/reign_year"/><br/> | |||
</td> | |||
<td> <!--해설--> | |||
<xsl:for-each select="description/p"> | |||
<xsl:value-of select="."/> | |||
<xsl:if test="position() != last()"> | |||
</xsl:if> | |||
</xsl:for-each> | |||
<br/> | |||
<div id="map" style="width:600px; height:400px;"></div> | |||
<script> | |||
var lat = <xsl:value-of select="coordinates/latitude"/>; | |||
var lon = <xsl:value-of select="coordinates/longitude"/>; | |||
var map = L.map('map').setView([lat, lon], 16); | |||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { | |||
maxZoom: 19, | |||
attribution: '&copy; OpenStreetMap contributors' | |||
}).addTo(map); | |||
L.marker([lat, lon]).addTo(map) | |||
.bindPopup('<xsl:value-of select="name/korean"/>') | |||
.openPopup(); | |||
</script> | |||
</td> | |||
</tr> | |||
</xsl:for-each> | |||
</table> | |||
</body> | |||
</html> | |||
</xsl:template> | |||
</xsl:stylesheet> | |||
==오류 검사== | |||
{{ ValidateXml | xml=문화유산:장소지도.xsl }} | |||
[[분류:Xml]] [[분류:김현]] | |||
<?xml version="1.0" encoding="UTF-8"?> | <?xml version="1.0" encoding="UTF-8"?> | ||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> | ||
| 42번째 줄: | 130번째 줄: | ||
</p> | </p> | ||
</xsl:template> | </xsl:template> | ||
2026년 4월 5일 (일) 12:34 판
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
문화유산:장소지도
| 명칭 | 주소 | 건립 | 설명 |
|---|---|---|---|
|
|
|
|
|
</xsl:stylesheet>
오류 검사
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8"/> <xsl:strip-space elements="*"/>
<xsl:template match="/">
문화유산:장소지도
</xsl:template>
<xsl:template match="place_list">
<xsl:apply-templates select="place"/>
</xsl:template>
<xsl:template match="place">
<xsl:value-of select="@id"/>
명칭: <xsl:value-of select="name/korean"/> (<xsl:value-of select="name/hanja"/>, <xsl:value-of select="name/english"/>)
주소: <xsl:value-of select="address"/> ( <xsl:value-of select="coordinates/latitude"/>, <xsl:value-of select="coordinates/longitude"/>, <xsl:value-of select="coordinates/altitude"/> )
</xsl:template>
</xsl:stylesheet>
오류 검사