0
XML로 XSLT를 구현하려고합니다. 웹 브라우저에서 xml을 볼 때 "애들레이드"거리가있는 중지 이름을 보려면 Xpath 표현식을 사용하십시오. XSLT를 적용하지 않으면 모든 xml을 봅니다. 대신 emplemant XSLTXSLT가 xml에 적용되지 않습니다.
XML
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="ltcstops.xslt"?>
<allstops>
<stop number="2504" name="Main & Bainard EB">
<location>
<latitude>42.91033567</latitude>
<longitude>-81.29671483</longitude>
</location>
<routes>28</routes>
</stop>
<stop number="20" name="Adelaide & Ada NB">
<location>
<latitude>42.9742886</latitude>
<longitude>-81.2252341</longitude>
</location>
<routes>16</routes>
</stop>
<stop number="22" name="Adelaide & Central Ave NB">
<location>
<latitude>42.9945666</latitude>
<longitude>-81.2343441</longitude>
</location>
<routes>16</routes>
</stop>
<allstops>
XSLT
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
<xsl:output method="html" indent="yes"/>
<xsl:variable name="theStreet" select="'Adelaide'" />
<xsl:variable name="theTitle" select="concat('stop ', $theStreet)" />
<xsl:template match="/">
<xsl:element name="html">
<xsl:element name="body">
<table style="width:720px" border="3">
<tr>
<td>Stop #</td>
<td>Route #</td>
<td>Name</td>
</tr>
<xsl:apply-templates select="/stop/@name=$theStreet"/>
</table>
</xsl:element>
</xsl:element>
</xsl:template>
<xsl:template match="stop">
<tr>
<td>
<xsl:value-of select="@number"/>
</td>
<td>
<xsl:value-of select="routes"/>
</td>
<td>
<xsl:value-of select="@name"/>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>