我使用XSLT 1.0 XML路徑和具有下面的示例代碼:如何獲得在XSLT XML節點值,如果我們必須在參數
在我的XSLT,我有其中有我的XML路徑設置了一個param
<xsl:param name="sitespath"/>
我知道可以加載它作爲文件,然後相應地進一步獲取值,像下面
<xsl:variable name="siteInfoPath" select="document($sitespath)/sitedata/region/site/language"/>
上面siteInfoPath XSLT varaible是升oading文檔與/sitedata /區域/網站/語言數據,但是現在我想利用PublishDate,下面是XML樣本格式
<?xml version="1.0"?>
<sitedata>
<resources>
<WorldwideSites>Worldwide sites</WorldwideSites>
<PublishedDate>10/3/2011 9:12:35 AM</PublishedDate>
</resources>
<region code="global" title="Global">
<site defaultLanguage="en" id="tcm:0-233-1" url="/english" countryCode="" title="" order="1">
<language code="en" pubId="tcm:0-233-1" pubPath="\english" Culture="en-GB" ShortDate="dd MMM yy" ShortDateShortDay="ddd dd MMM yy" ShortDateTime="dd MMM yy, HH:mm" LongDate="d MMMM, yyyy" LongDateTime="d MMMM, yyyy, HH:mm" LongDateExtendedShortDay="ddd dd MMM, yyyy" LongDateExtended="dddd, d MMMM, yyyy" LongDateExtendedTime="dddd, d MMMM, yyyy, HH:mm" MonthYear="MMMM, yyyy" OmniturePrefix="ek global:en:" OmnitureReportSuite="emirnewglobalenglish,emirnewibems" OmnitureDevReportSuite="emirglobalendev" sifr="Y" localTitle="" url="/english" mobileRedirect="true" flightStatusAlert="true" GoLiveDate="20071110" targetHost="http://fly1.com" hpSearchF="Yes" hpHotelsCars="Yes" hpMYB="Yes" hpOLCI="Yes" hpFStatus="Yes" hpServicesF="Yes">English</language>
</site>
我需要使用另一個變量,需要加載像這樣的文檔
<xsl:variable name="siteInfoDate" select="document($sitespath)/sitedata/resources/PublishedDate"/>
我不想再次加載相同的XML ...請建議!!
謝謝迪米特清除所有這些概念! –
@Manu:不客氣。 –