xslt-2.0

XSLT Call-Template name attribute

女生的网名这么多〃 提交于 2019-12-11 03:40:43
问题 It seems as if I can't use an Xpath in the name attribute of the call-template element. How can I get around this? Any help/thoughts would be awesome! <xsl:for-each select="child::knomaddb/Content/Videos"> <xsl:result-document method="xhtml" href="{local-name()}.html"> <html> <body> <h1>Knomad</h1> <h2>{local-name()} Videos</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>Title</th> <th>Video</th> <th>Description</th> <th>Comments</th> </tr> <xsl:for-each select="Video"> <xsl:call-template

XSLT: create 'key' across multiple documents?

China☆狼群 提交于 2019-12-11 03:32:54
问题 Following from a previous question 'xslt: select unique node via intermediate reference node?'. Is there anyway to use a 'key' that references multiple xml documents. Something like: <xsl:key name="ChildByFIdAndMFId" match="collection('file:///c:/temp/xslt?select=test*.xml')Child" use="concat(FathersID, '+', MothersFatherID)"/> That gives an error "The collection function is not allowed at the head of a pattern". I'm trying to reference all the matching 'child' nodes by FathersID and

Output values in a certain way using XSLT/XPath 2.0

隐身守侯 提交于 2019-12-11 03:16:57
问题 I have an XML like this: <?xml version="1.0" encoding="UTF-8"?> <Section> <Chapter> <Cell colname="1"> <Value>A</Value> </Cell> <Cell colname="2"> <MyValue>AAA</MyValue> <MyValue>BBB</MyValue> </Cell> <Cell colname="3"> <MyCar>Honda</MyCar> </Cell> </Chapter> <Chapter> <Cell colname="1"> <Value>C</Value> </Cell> <Cell colname="2"> <MyValue>CCC</MyValue> </Cell> <Cell colname="3"> <MyCar>Toyota</MyCar> </Cell> </Chapter> </Section> I like the have a message (later on convert them tags) output

Replacing and maintaining character entities through multiple transformations

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 02:58:11
问题 Problem: We have character entities come to our systems in various formats (Ex: & and &amp; ) and we need to convert them to a standard XML character entities if needed ( &amp < > &apos; " ) and then maintain them as entities through a couple of separate tranformations. Given XML of: <rootelm> <testdata>&apos; &gt; &lt; &quot;</testdata> </rootelm> and a stylesheet of (based on xsl:character-map to replace special characters): <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

XSLT: 'value-of select' using keys and conditions?

Deadly 提交于 2019-12-10 23:54:26
问题 this question follows on from previous thread: XSLT: Sorting based on sum of values from other nodes I can now get my data summed from the other nodes by using keys. What I can't seem to get is the syntax or method needed to now apply conditions to select the data I'm after while using these keys. Here is a simplified xml I'm using (modified from last one to highlight issues): <Horses> <Horse> <ID>1</ID> <Name>hrsA</Name> <SireID>101</SireID> <Age>3</Age> <Pace> <Stakes>20</Stakes> <Wins>0<

Namespaces in XSLT

只愿长相守 提交于 2019-12-10 20:24:44
问题 I'm learning how to do custom functions in XSLT. Every example I find seems to declare a custom namespace, e.g. <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:mynamespace="http://whatever"> What I don't understand is what should go where I currently have 'http://whatever', and what does this do? Can't I use the default xsl namespace to make functions? Thanks in advance for any help 回答1: From http://www.w3.org/TR/xslt20/#stylesheet-functions Note: The

xslt 2.0 compare current date to start and end date

余生长醉 提交于 2019-12-10 20:15:52
问题 I have the following output: <forms> <form id="15"> <start>2013-12-09</start> <end>2014-01-05</end> </form> </forms> I would like to test to see if current date is equal or greater to "start" and lesser or equal to "end" How would I go about testing for this? What I had in mind is: <xsl:variable name="fstart"> <xsl:value-of select="start" /> </xsl:variable> <xsl:variable name="fend"> <xsl:value-of select="end" /> </xsl:variable> <xsl:choose> <xsl:when test="$fstart >= currentdate xor

Converting and HL7 segment to XML

非 Y 不嫁゛ 提交于 2019-12-10 19:56:28
问题 i have an XML that we were able to generate using HAPI libraries and use XSL to change the format of the XML. I am using the following template. The current template looks at the OBX.5 segment for a digital value and then interprets the OBX6 (units of measure). However I am trying to also interpret the OBX6 when they come from one of the clients in a style as duplicates with the caret ^ in between (ex: %^% or mL^mL ). My current template ignores this but I would like to be able to get the

Test if document is well formed before parsing

我的未来我决定 提交于 2019-12-10 18:47:56
问题 I need to analyze a few thousand XML documents to see if some of them contains a certain construct. The problem is that some of the documents doesn't contain well formed XML. The basic idea was to use fn:collection() and search inside nodes returned. But this only works if all documents in the collection are well formed. Is it possible to do something similar but only parsing the well formed documents? This is my XSLT, simplified, which works if all documents in $dir are well formed: <?xml

How to check if xml textnode has Chinese characters with RegEx in a XSLT

倾然丶 夕夏残阳落幕 提交于 2019-12-10 16:09:00
问题 On this website http://gskinner.com/RegExr/ (which is a RegEx test website) this regex match works Match: [^\x00-\xff] Sample Text: test123 或元件数据不可用 But if I have this input XML: <?xml version="1.0" encoding="UTF-8" ?> <root> <node>test123 或元件数据不可用</node> </root> and I try this XSLT 2.0 stylesheet with Saxon 9: <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/root/node"> <xsl:if test="matches(., '[^