2010-09-17 26 views
1

編輯Commerce Server產品詳細信息Web部件時,我們對XSLT模板進行更改時遇到了很大困難。這些並不是很複雜的變化,只是一些小的變化。這個模板沒有問題,因爲我已經在w3schools XSLT編輯器上試過了,它工作正常。在Commerce Server 2009 Web部件中保存XSLT模板

我將模板文本粘貼到對話框中,然後單擊「保存」以覆蓋模板。

我得到的錯誤「錯誤保存XSLT:{0}」

相反,如果我編輯對話框中的文本,而無需使用其他編輯器(和格式化,因爲所有CRLFs獲得剝奪),它的工作原理。

我在做什麼錯?

我希望你可以編輯提供的,因爲它有NO格式化

這裏的文本框外的文字是怎麼弄出來的文本框:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="html" version="1.0" indent="yes" /><xsl:template match="/products/product"><H1><xsl:value-of select="properties/property[@name='DisplayName']" /></H1></xsl:template></xsl:stylesheet> 

爲一行。我想像這樣編輯它:

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
    <xsl:output method="html" version="1.0" indent="yes" /> 
    <xsl:template match="/products/product"> 
    <H1> 
     <xsl:value-of select="properties/property[@name='DisplayName']" /> 
    </H1> 
    </xsl:template> 
</xsl:stylesheet> 

更好。

+0

問得好(+1)。查看我的答案,瞭解簡單高效的XSLT解決方案。 – 2010-09-18 14:56:26

回答

1

步驟這樣做:

  1. 你可以寫你的XSLT舒適在您選擇的IDE /編輯器。

  2. 工作,直到它滿足所有要求。

  3. 最後,處理您的XSLT樣式表有以下改造,結果喂到商業服務器:

::

<xsl:stylesheet version="1.0" 
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
    <xsl:output omit-xml-declaration="yes" indent="no"/> 
    <xsl:strip-space elements="*"/> 

<xsl:template match="node()|@*"> 
    <xsl:copy> 
     <xsl:apply-templates select="node()|@*"/> 
    </xsl:copy> 
</xsl:template> 
</xsl:stylesheet> 

當這一轉變對您的優雅格式代碼執行

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
    <xsl:output method="html" version="1.0" indent="yes" /> 
    <xsl:template match="/products/product"> 
    <H1> 
     <xsl:value-of select="properties/property[@name='DisplayName']" /> 
    </H1> 
    </xsl:template> 
</xsl:stylesheet> 

想要的結果,就是產生由商務部服務器可以接受的:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:output method="html" version="1.0" indent="yes"/><xsl:template match="/products/product"><H1><xsl:value-of select="properties/property[@name='DisplayName']"/></H1></xsl:template></xsl:stylesheet> 
+0

我會試一試,但空白讓它窒息,這是瘋狂的瘋狂。 – 2010-09-19 14:09:28

+0

@ Jeff-Cuscutis:你有兩種選擇:1,抱怨團隊,等待2 - 3年後的下一個版本。 2.使用我的解決方案。 :) – 2010-09-19 14:49:19

+0

您的解決方案工作。謝謝!空白和換行符使它窒息仍然是瘋狂的。任何人都沒有關於此事的任何信息。SharePoint用戶是否因爲不得不在SharePoint中工作而受到挫折,這甚至不會讓他們感到困惑? – 2010-09-20 13:01:03