0
xslt 1.0에서 jquery를 사용하려고했지만 작동하지 못했습니다. xslt를 처음 사용하고 잘 모르겠습니다.XSLT 1.0에서 Jquery를 사용하는 방법
내가 시도 동봉 된 코드 :
<xsl:stylesheet xmlns:x="http://www.w3.org/2001/XMLSchema"
version="1.0" exclude-result-prefixes="xsl ddwrt msxsl rssaggwrt"
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
xmlns:rssaggwrt="http://schemas.microsoft.com/WebParts/v3/rssagg/runtime"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:rssFeed="urn:schemas-microsoft-com:sharepoint:RSSAggregatorWebPart"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:rss1="http://purl.org/rss/1.0/" xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
xmlns:atom2="http://purl.org/atom/ns#">
<xsl:param name="rss_FeedLimit">5</xsl:param>
<xsl:param name="rss_ExpandFeed">false</xsl:param>
<xsl:param name="rss_LCID">1033</xsl:param>
<xsl:param name="rss_WebPartID">RSS_Viewer_WebPart</xsl:param>
<xsl:param name="rss_alignValue">left</xsl:param>
<xsl:param name="rss_IsDesignMode">False</xsl:param>
<xsl:output method="html"/>
<xsl:template name="RSSMainTemplate" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:variable name="Rows" select="channel/item"/>
<xsl:variable name="RowCount" select="count($Rows)"/>
<div class="slm-layout-main" >
<xsl:call-template name="RSSMainTemplate.body">
<xsl:with-param name="Rows" select="$Rows"/>
<xsl:with-param name="RowCount" select="count($Rows)"/>
</xsl:call-template>
</div>
<script type="text/javascript">
<![CDATA[
$('.RssNewContent1').each(function()
{
//alert("test");
var height = parseInt($(this).css("height"));
var content = $(this).html();
while (this.scrollHeight > height)
{
content = content.replace(/\s+\S*$/, "");
$(this).html(content + " " + "...");
}
});
]]>
</script>
</xsl:template>
<xsl:template name="RSSMainTemplate.body" xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:param name="Rows"/>
<xsl:param name="RowCount"/>
<xsl:for-each select="$Rows">
<xsl:variable name="CurPosition" select="position()" />
<xsl:if test="($CurPosition <= $rss_FeedLimit)">
<div class="RssNewContent1" >
<a href = "{link}" target="_blank">
<xsl:value-of select="title" />
</a>
<xsl:value-of disable-output-escaping="yes" select="string(description)" />
</div>
</div>
</xsl:if>
</xsl:for-each>
</xsl:template>
어떤 도움이 크게 감사합니다! 미리 감사드립니다 !!
개인적인 제안 : XSLT를 사용하지 마십시오. 다른 브라우저의 구현에있는 버그는 죽은 기술로 간주되기 때문에 수정되지 않았습니다. 대신 AJAX를 사용하여 XML에서 필요한 데이터를 분석하여 자신의 HTML 문서로 만듭니다. – Blazemonger
@NewGirlInCalgary 정확히 어떻게 실패합니까? – Louis
@ 루이스 아무 것도하지 않습니다. 나에게 알림 상자조차 보이지 않습니다. 모든 것을 제거하고 alert(); 그것조차도 작동하지 않습니다. 내가 무엇을 잘못하고 있는지 확실하지 않습니다. – NewGirlInCalgary