EDN Admin
Well-known member
System.Xml.Xsl.XslLoadException:Expected end of the expression, findXXX<br/>
System.Xml.Xsl.XslCompiledTransform.Load(String stylesheetUri)
The c# is ok, because if I change the content of the .xsl file, the if the error is gone. I found this fact:
When the columns name contains numbers, and only if the number is at the start if the string, it will raise this error. For example, if the columns name string is just like 1read, it will raise the error, but not when its like read1.
The xsl is like this:
<xsl:stylesheet xmlns:xsl=" http://www.w3.org/1999/XSL/Transform http://www.w3.org/1999/XSL/Transform " version="1.0
- <xsl:template match="/ <br/>
- <HTML><br/>
- <HEAD><br/>
<STYLE>.stdPageHdr {color: DarkBlue;font-weight: bold;font-style:italic;font-family:Verdana;text-align: left;padding-left: 4px;padding-top: 4px;padding-bottom: 4px;width: 100%;font-size: 14pt;}.gridHeader {background-color: #666699;color: White;font-size:
9pt;font-weight: bold;font-family:Verdana;vertical-align:middle;text-align:center;border: solid thin Black;}.GoalHead {background-color: #CE0000;color: White;font-size: 9pt;font-weight: bold;font-family:Verdana;vertical-align:middle;text-align:center;border:
solid thin Black;}.SearchHeader {color: DarkBlue;font-size: 9pt;font-weight: bold;font-family:Verdana;}.SearchKey {color: DarkBlue;font-size: 9pt;vertical-align:middle;text-align:right;font-family:Verdana;}.SearchValue {color: Black;font-size: 9pt;font-weight:
bold;vertical-align:middle;text-align:left;font-family:Verdana;}.SearchResultItem {background-color: #CCCCFF;color: Black;font-size: 8pt;font-family:Verdana;border: solid thin Black;}.SearchResultAltItem {background-color: #CCFFFF;color: Black;font-size: 8pt;font-family:Verdana;border:
solid thin Black;}</STYLE> <br/>
</HEAD><br/>
- <BODY><br/>
- <TABLE><br/>
- <TR><br/>
<TD class="gridHeader 1read</TD> <br/>
</TR><br/>
<xsl:for-each select="NewDataSet/Table1 <br/>
- <xsl:choose><br/>
- <xsl:when test="position() mod 2 = 1 <br/>
- <TR><br/>
- <TD class="SearchResultItem <br/>
<xsl:value-of select="1read" /> <br/>
</TD><br/>
</TR><br/>
</xsl:when><br/>
- <xsltherwise><br/>
<TR><br/>
- <TD class="SearchResultAltItem <br/>
<xsl:value-of select="1read" /> <br/>
</TD><br/>
</TR><br/>
</xsltherwise><br/>
</xsl:choose><br/>
</xsl:for-each><br/>
</TABLE><br/>
</BODY><br/>
</HTML><br/>
</xsl:template><br/>
</xsl:stylesheet>
You can use the xml above to test it. And you will see, when you change <xsl:value-of select="1read" /> to only contains English characters, it will be ok. When it only contains numbers like 123, it will be ok too.<br/>
But when you combination the English characters and numbers and put the numbers at the begining, like 1read, 2thread, or anything like this, you will see the error.
By the way, it will give another error: Unexpected Token XX in expression, if I put in the [, or other special characters.<br/>
So whats the correct way to input something into the .xsl file and read it out by XslCompiledTransform.Load() rightly?
I found every where in MSDN, nothing found.
yours,<br/>
Ivan <hr class="sig OLAPSSISKPI
View the full article
System.Xml.Xsl.XslCompiledTransform.Load(String stylesheetUri)
The c# is ok, because if I change the content of the .xsl file, the if the error is gone. I found this fact:
When the columns name contains numbers, and only if the number is at the start if the string, it will raise this error. For example, if the columns name string is just like 1read, it will raise the error, but not when its like read1.
The xsl is like this:
<xsl:stylesheet xmlns:xsl=" http://www.w3.org/1999/XSL/Transform http://www.w3.org/1999/XSL/Transform " version="1.0
- <xsl:template match="/ <br/>
- <HTML><br/>
- <HEAD><br/>
<STYLE>.stdPageHdr {color: DarkBlue;font-weight: bold;font-style:italic;font-family:Verdana;text-align: left;padding-left: 4px;padding-top: 4px;padding-bottom: 4px;width: 100%;font-size: 14pt;}.gridHeader {background-color: #666699;color: White;font-size:
9pt;font-weight: bold;font-family:Verdana;vertical-align:middle;text-align:center;border: solid thin Black;}.GoalHead {background-color: #CE0000;color: White;font-size: 9pt;font-weight: bold;font-family:Verdana;vertical-align:middle;text-align:center;border:
solid thin Black;}.SearchHeader {color: DarkBlue;font-size: 9pt;font-weight: bold;font-family:Verdana;}.SearchKey {color: DarkBlue;font-size: 9pt;vertical-align:middle;text-align:right;font-family:Verdana;}.SearchValue {color: Black;font-size: 9pt;font-weight:
bold;vertical-align:middle;text-align:left;font-family:Verdana;}.SearchResultItem {background-color: #CCCCFF;color: Black;font-size: 8pt;font-family:Verdana;border: solid thin Black;}.SearchResultAltItem {background-color: #CCFFFF;color: Black;font-size: 8pt;font-family:Verdana;border:
solid thin Black;}</STYLE> <br/>
</HEAD><br/>
- <BODY><br/>
- <TABLE><br/>
- <TR><br/>
<TD class="gridHeader 1read</TD> <br/>
</TR><br/>
<xsl:for-each select="NewDataSet/Table1 <br/>
- <xsl:choose><br/>
- <xsl:when test="position() mod 2 = 1 <br/>
- <TR><br/>
- <TD class="SearchResultItem <br/>
<xsl:value-of select="1read" /> <br/>
</TD><br/>
</TR><br/>
</xsl:when><br/>
- <xsltherwise><br/>
<TR><br/>
- <TD class="SearchResultAltItem <br/>
<xsl:value-of select="1read" /> <br/>
</TD><br/>
</TR><br/>
</xsltherwise><br/>
</xsl:choose><br/>
</xsl:for-each><br/>
</TABLE><br/>
</BODY><br/>
</HTML><br/>
</xsl:template><br/>
</xsl:stylesheet>
You can use the xml above to test it. And you will see, when you change <xsl:value-of select="1read" /> to only contains English characters, it will be ok. When it only contains numbers like 123, it will be ok too.<br/>
But when you combination the English characters and numbers and put the numbers at the begining, like 1read, 2thread, or anything like this, you will see the error.
By the way, it will give another error: Unexpected Token XX in expression, if I put in the [, or other special characters.<br/>
So whats the correct way to input something into the .xsl file and read it out by XslCompiledTransform.Load() rightly?
I found every where in MSDN, nothing found.
yours,<br/>
Ivan <hr class="sig OLAPSSISKPI
View the full article