如何将 xslt 2.0 版转换为 1.0 版 [英] how to convert xslt version 2.0 to version 1.0
问题描述
我正在使用使用 xpath 版本 2 功能的 xslt 文档.我只有 xalan 2.6 jar,它有 xslt 1.0 处理器,这是一个约束,我不能改变它..如果有任何工具可以将 xpath 2.0 函数转换为 1.0,请帮助我
<xsl:variable name="var1_ClinicalDocument" as="node()?"select="ns0:ClinicalDocument"/><DSMessage><DSP患者><xsl:for-eachselect="$var1_ClinicalDocument[fn:exists(ns0:id/@root)]"><来源><xsl:sequence select="fn:string(ns0:id/@root)"/></来源></xsl:for-each><人口统计信息><xsl:for-each select="($var1_ClinicalDocument/ns0:recordTarget/ns0:patientRole/ns0:id)[fn:exists(@extension)]"><外部ID><xsl:sequence select="fn:string(@extension)"/></externalID></xsl:for-each><xsl:for-each select="($var1_ClinicalDocument/ns0:recordTarget/ns0:patientRole/ns0:patient/ns0:name/ns0:given/node())[fn:boolean(self::text())]"><名字><xsl:sequence select="fn:string(.)"/></名字>
以下是相关 XPath 2.0 函数的映射:
<预>XPath 2.0 XPath 1.0 Xalan-Java XSLT-Cfn:exists() 字符串长度(concat(., ) ) XPath 1.0 XPath 1.0fn:string() string() XPath 1.0 XPath 1.0fn:boolean() boolean() XPath 1.0 XPath 1.0EXSLT、XSLTSL、FXSL 和 XPath 算法可以填补大部分剩余功能.
<预>XPath 2.0 FXSL XSLTSL EXSLT XPath 1.0fn:最大最大数学:最大fn:最大动态:最大fn:min 最小数学:minfn:min 动态:minfn:sum sum 数学:sum sumfn:总和 动态:总和fn:avg sum div 计数fn:地板地板fn:天花板fn:圆形fn:abs 数学:absfn:收藏夹操作:连接追加fn:doc 文档fn:计数计数fn:不是不是fn:真真fn:假假fn:boolean 布尔值fn:upper-case str:to-upperfn:小写 str:to-lowerfn:substring 子串fn:字符串长度字符串长度fn:normalize-space 规范化空间fn:translate 翻译fn:concat str:concat concatfn:substring-before substring-beforefn:substring-after 子串后fn:反向 str:向后fn:insert-before str:insert-atfn:matches str:string-matchfn:tokenize str:tokenizefn:resolve-uri uri:resolve-urifn:distinct-values set:distinct操作:联合 |操作:相交集:相交操作:除了 cmp:差异集:差异op:is-same-node cmp:cmpfn:位置节点:xpath 位置fn:最后一个fn:数据节点:类型fn:朗朗fn:当前日期时间日期:日期时间fn:dateTime dt:format-date-time date:format-datefn:year-from-date dt:get-xsd-datetime-year date:day-in-yearfn:month-from-dateTime dt:get-xsd-datetime-month date:month-namefn:day-from-dateTime dt:get-xsd-datetime-day date:day-namefn:hours-from-dateTime dt:get-xsd-datetime-hour date:hour-in-dayfn:minutes-from-dateTime dt:get-xsd-datetime-minute date:minute-in-hourfn:seconds-from-dateTime dt:get-xsd-datetime-second date:second-in-minutefn:timezone-from-dateTime dt:get-xsd-datetime-timezoneif (...) then (...) else(...) $dynamic[$var] |$default[not($var)]参考资料
- 立>
i am using xslt document which uses xpath version 2 functions. I only have xalan 2.6 jar which has xslt 1.0 processor, its a constraint i cannot change it..please help me if there are any tools that convert xpath 2.0 functions to 1.0
<xsl:variable name="var1_ClinicalDocument" as="node()?" select="ns0:ClinicalDocument"/>
<DSMessage>
<DSPatient>
<xsl:for-each
select="$var1_ClinicalDocument[fn:exists(ns0:id/@root)]">
<Source>
<xsl:sequence select="fn:string(ns0:id/@root)"/>
</Source>
</xsl:for-each>
<Demographics>
<xsl:for-each select="($var1_ClinicalDocument/ns0:recordTarget/ns0:patientRole/ns0:id)[fn:exists(@extension)]">
<externalID>
<xsl:sequence select="fn:string(@extension)"/>
</externalID>
</xsl:for-each>
<xsl:for-each select="($var1_ClinicalDocument/ns0:recordTarget/ns0:patientRole/ns0:patient/ns0:name/ns0:given/node())[fn:boolean(self::text())]">
<firstName>
<xsl:sequence select="fn:string(.)"/>
</firstName>
Here is a mapping of the XPath 2.0 functions in question:
XPath 2.0 XPath 1.0 Xalan-Java XSLT-C fn:exists() string-length(concat(., ) ) XPath 1.0 XPath 1.0 fn:string() string() XPath 1.0 XPath 1.0 fn:boolean() boolean() XPath 1.0 XPath 1.0
EXSLT, XSLTSL, FXSL, and XPath algorithms can fill in most of the remaining functionality.
XPath 2.0 FXSL XSLTSL EXSLT XPath 1.0 fn:max maximum math:max fn:max dyn:max fn:min minimum math:min fn:min dyn:min fn:sum sum math:sum sum fn:sum dyn:sum fn:avg sum div count fn:floor floor fn:ceiling ceiling fn:round round fn:abs math:abs fn:collection foldl op:concatenate append fn:doc document fn:count count fn:not not fn:true true fn:false false fn:boolean boolean fn:upper-case str:to-upper fn:lower-case str:to-lower fn:substring substring fn:string-length string-length fn:normalize-space normalize-space fn:translate translate fn:concat str:concat concat fn:substring-before substring-before fn:substring-after substring-after fn:reverse str:backward fn:insert-before str:insert-at fn:matches str:string-match fn:tokenize str:tokenize fn:resolve-uri uri:resolve-uri fn:distinct-values set:distinct op:union | op:intersect set:intersection op:except cmp:diff set:difference op:is-same-node cmp:cmp fn:position node:xpath position fn:last last fn:data node:type fn:lang lang fn:current-dateTime date:date-time fn:dateTime dt:format-date-time date:format-date fn:year-from-date dt:get-xsd-datetime-year date:day-in-year fn:month-from-dateTime dt:get-xsd-datetime-month date:month-name fn:day-from-dateTime dt:get-xsd-datetime-day date:day-name fn:hours-from-dateTime dt:get-xsd-datetime-hour date:hour-in-day fn:minutes-from-dateTime dt:get-xsd-datetime-minute date:minute-in-hour fn:seconds-from-dateTime dt:get-xsd-datetime-second date:second-in-minute fn:timezone-from-dateTime dt:get-xsd-datetime-timezone if (...) then (...) else(...) $dynamic[$var] | $default[not($var)]
References
Web XSLT: XSLT and JavaScript code intended mostly for manipulating MathML and OpenMath.
XQuery 1.0 and XPath 2.0 Functions and Operators (Second Edition)
这篇关于如何将 xslt 2.0 版转换为 1.0 版的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!