2012-10-10 67 views
0

我遇到這個錯誤,當我試圖驗證我的XSLTXSLT驗證錯誤javax.xml.transform.TransformerConfigurationException:

javax.xml.transform.TransformerConfigurationException: 
    javax.xml.transform.TransformerException: 
    javax.xml.transform.TransformerException: 
    A node test that matches either NCName:* or QName was expected. 

這是我的XSLT

<?xml version="1.0" encoding="ISO-8859-1"?> 
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:output method="html" /> 
<xsl:template match="\Apps"> 
<html> 
<head> <title>Apps List</title> 
<link rel="StyleSheet" href="table_style.css" type="text/css"/> 
<style type="text/css"> 
body {font-family: Helvetca;} 
h1 { color : Grey;} 
h2 {color : Blue;}</style> 
</head> 
<body> 
<h1> Apps List: <xsl:value-of select="\@List_Type" /></h1> 
<p>This is a list of all currently hot apps:</p> 
<xsl:for-each select="\App"> 
<xsl:if test="\App\@installed == true"> 
<h2 style="color:Green;"><xsl:value-of select="\App\app_name" />(instaled)</h2> 
</xsl:if> 
<xsl:otherwise> 
<h2><xsl:value-of select="\App\app_name" /></h2> 
</xsl:otherwise> 
<p style="font-style:bold;">App info:</p> 
<table id="#gradient-style"> 
<tr><th>Category:</th><td><xsl:value-of select="\App\catogry" /></td></tr> 
<tr><th>Verdion:</th><td><xsl:value-of select="\App\version" /></td></tr> 
<tr><th>Description:</th><td><xsl:value-of select="\App\description" /></td></tr> 
<tr><th>App Reviews:</th><td><xsl:for-each select="\App\reviews\review"> 
<span style="font-style:bold;"><xsl:value-of select="\App\reviews\review\reviewer_name" /></span> 
| <xsl:value-of select="\App\reviews\review\review_date" /> 
| <xsl:value-of select="\App\reviews\review\review_Time" /><br/> 
<span style="font-style:bold;">Rating:</span> 
<xsl:value-of select="string(\App\reviews\review\rating" /> <br/> 
<xsl:value-of select="\App\reviews\review\ontent" /><br/> 
---------------------------------------------------------- 
</xsl:for-each> 
</td></tr> 
</table> 
</xsl:for-each> 
</body> 
</html> 
</xsl:template> 
</xsl:stylesheet> 

這是XML是與

<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet type="text/xsl" href="ShdenXSLT.xsl"?> 
<Apps xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" List_Type="new releases" > 
<App device_type="tablet" app_id="120"> 
<app_name>Meeting Manager</app_name> 
<catogry>LifeStyle </catogry> 
<catogry>Bussnisse </catogry> 
<version>1.0</version> 
<description>This app is about managing the bussnisse meeting</description> 
<reviews> 
<review> 
<reviewer_name>Shaden</reviewer_name> 
<review_date>2012-02-13</review_date> 
<review_time>11:35:02</review_time> 
<content>it was a useful app</content> 
<rating>4.5</rating> 
</review>   
<review> 
<reviewer_name>Mohamed</reviewer_name> 
<review_date>2012-03-01</review_date> 
<review_time>12:15:00</review_time> 
<content>i really loved this app</content> 
<rating>5.0</rating> 
</review> 
</reviews> 
</App> 

<App device_type="tablet" app_id="100"> 
<app_name>ToDoList</app_name> 
<catogry>LifeStyle </catogry> 
<version>3.4.2</version> 
<description>a simple To Do List applecation</description> 
<reviews> 
<review> 
<reviewer_name>Fahad</reviewer_name> 
<review_date>2010-02-05</review_date> 
<review_time>09:40:55</review_time> 
<content>nice app</content> 
<rating>4.0</rating> 
</review> 
</reviews> 
</App> 
</Apps> 

回答

1

您正在使用反斜槓(\)試圖爲您的XPath分離器(即<xsl:value-of select="\@List_Type" />),這是不正確的。它應該是一個正斜槓(/

+0

嗯我注意到後來我修好了,但沒有任何改變 – Shaden