stackoverflow的好人...我正在尝试创建一个XSLT转换,它将生成一个Turtle文件(与RDF相关)。其中一部分涉及前缀命名空间的输出,如下所示:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sap="http://www.sap.com/sapxsl"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:sap_coda="http://www.sapmantics.com/sap_coda#"
version="1.0">
<xsl:strip-space elements="*"/>
<xsl:template match="/">
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>' .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
...
当我尝试应用转换时,我得到:
$ xsltproc zcoda_ttl_v02x.xslt zcoda_data_v02.xml > zcoda_data_v02x.ttl | x.txt
zcoda_ttl_v02x.xslt:10: namespace error : Failed to parse QName 'http:'
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>' .
^
zcoda_ttl_v02x.xslt:10: parser error : error parsing attribute name
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>' .
^
zcoda_ttl_v02x.xslt:10: parser error : attributes construct error
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>' .
^
zcoda_ttl_v02x.xslt:10: parser error : Couldn't find end of Start Tag http: line 10
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>' .
所以,我在这里不知所措。我寻求的海龟输出包含许多这些情况。有没有办法停止处理器,只考虑http ...作为普通数据(如xml中的CDATA选项)?谢谢,约翰
答案 0 :(得分:0)
您可以将http内容包含在xsl:text中我猜:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:sap="http://www.sap.com/sapxsl"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:sap_coda="http://www.sapmantics.com/sap_coda#"
version="1.0">
<xsl:strip-space elements="*"/>
<xsl:template match="/">
@prefix rdfs: <xsl:text><![CDATA[<http://www.w3.org/2000/01/rdf-schema#>]]></xsl:text>
答案 1 :(得分:0)
使用实体:
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>' .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .