날짜를 문자열로 가져오고 다음과 같은 형식으로 날짜를 표시해야합니다. MM/DD/YYYY 연도가 1 년인 경우 01/01을 추가해야합니다. 오늘부터 2 년이 넘은 앨범도 굵게 표시해야합니다. 어떻게해야합니까? fuctions를 어떻게 추가합니까? JQUERY 만 사용할 수 있으며 JS는 사용할 수 없습니다. 감사합니다. .xsl에서 jquery 함수를 추가하는 방법 (날짜)
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:ms="urn:schemas-microsoft-com:xslt"
xmlns:dt="urn:schemas-microsoft-com:datatypes">
<xsl:template match="/">
<html>
<body>
<style>
u {
text-decoration: underline;
font-weight: bold;
}
</style>
<table border="1">
<tr bgcolor="#979994">
<th style="text-align:left">Price</th>
<th style="text-align:left">Link</th>
<th style="text-align:left">Company</th>
<th style="text-align:left">Name</th>
<th style="text-align:left">Date</th>
<th style="text-align:left">Artist</th>
</tr>
<xsl:for-each select="Albums/Album">
<tr>
<td><xsl:value-of select="Price"/></td>
<td><xsl:value-of select="Link"/></td>
<td><xsl:value-of select="Company"/></td>
<td><xsl:value-of select="Name"/></td>
<td><xsl:value-of select="Date" /></td>
<td style="color:red;"><xsl:value-of select="Artist"/></td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
와 XML :
는 XSLT에서 자바 스크립트 함수를 호출 할 수 있습니다 동안<?xml version="1.0" encoding="ISO8859-1"?>
<?xml-stylesheet type="text/xsl" href="Albums1.xs"?>
<Albums>
<Album>
<Name>Empire Burlesque</Name>
<Artist>Bob Dylan</Artist>
<Country>USA</Country>
<Company>Columbia</Company>
<Date>19880610</Date>
</Album>
<Album>
<Name>Hide your heart</Name>
<Artist>Bonnie Tylor</Artist>
<Country>UK</Country>
<Company>CBS Records</Company>
<Price>9.90</Price>
<Date>19880509</Date>
</Album>
<Album>
<Name>Greatest Hits</Name>
<Artist>Dolly Parton</Artist>
<Country>USA</Country>
<Company>RCA</Company>
<Price>9.90</Price>
<Date>1982</Date>
</Album>
<Album>
<Name>Still got the blues</Name>
<Artist>Gary More</Artist>
<Country>UK</Country>
<Company>Virgin redords</Company>
<Price>10.20</Price>
<Date>1990</Date>
</Album>
<Album>
<Name>Eros</Name>
<Artist>Eros Ramazzotti</Artist>
<Country>EU</Country>
<Company>BMG</Company>
<Price>9.90</Price>
<Date>1997</Date>
</Album>
<Album>
<Name>25</Name>
<Artist>Adele</Artist>
<Country>UK</Country>
<Company>XL Recordings</Company>
<Price>9.90</Price>
<Date>20151120</Date>
</Album>
<Album>
<Name>1000 Forms of Fear</Name>
<Artist>Sia</Artist>
<Country>USA</Country>
<Company>RCA Records</Company>
<Price>9.90</Price>
<Date>20140704</Date>
</Album>
<Album>
<Name>Rattle and Hum</Name>
<Artist>U2</Artist>
<Country>EU</Country>
<Company>Island</Company>
<Price>9.90</Price>
<Date>19881010</Date>
</Album>
</Albums>
jQuery를 *이 * JS입니다. – charlietfl
나는 아무 계획도없이 그것을하도록 요구 받았다. jQuery를 사용하려면 – user4485863
자바 스크립트를 전혀 사용하지 않고 순수하게 XSLT에서도이 작업을 수행 할 수 있습니다. 정말 jquery를 사용해야합니까? –