xslt-1.0

xsl:key not working when looping through nodeset obtained with xalan:nodeset

删除回忆录丶 提交于 2019-12-06 02:42:12
问题 I have found a case where xsl:key seems not to be working. I am using XSLT 1 with Xalan (compiled) and this is what is happening: 1.- This works: key named test1 works fine: <xsl:variable name="promosRTF"> <xsl:copy-of select="promo[@valid='true']"/> </xsl:variable> <xsl:variable name="promos" select="xalan:nodeset($promosRTF)" /> <!-- now the key: when defined and used here it works fine: --> <xsl:key name="test1" match="//promo" use="'anytext'" /> <xsl:for-each select="key('test1','anytext'

Select descendant elements that are not contained in another type of element

筅森魡賤 提交于 2019-12-06 01:48:06
问题 In XPath 1.0, how can I select all descendant nodes C of current (context) node A, that are not contained in an intervening node of type B? For example, find all <a> links contained in the current element, that are not inside a <p> . But if the current element is itself inside a <p> , that's irrelevant. <p> <—— this is irrelevant, because it's outside the current element ... <div> <—— current element (context node) ... <a></a> <—— the xpath should select this node ... <p> ... <a></a> <—— but

xslt counting different content of the same content

谁说胖子不能爱 提交于 2019-12-06 00:30:03
just started studying xslt.just want to know how would count the number of international based players? Another thing is the average height of he international players? <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="soccer.xslt"?> <footballclub> <player> <based>international</based> <height>5.5</height > <build>medium</build> <age>24</age> </player> <player> <based>local</based> <height>5.5</height > <build>medium</build> <age>24</age> </player> <player> <based>international</based> <height>5.5</height > <build>medium</build> <age>24</age> </player> <player>

XSLT: How to generate unique id for node based on value only

本秂侑毒 提交于 2019-12-05 20:32:32
I have a source XML that contains address elements which could have the same values (please note that Contact/id=1 and Contact/id=3 have the same address: <?xml version="1.0" encoding="utf-8"?> <Contacts xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Contact> <id>1</id> <Address> <City City="Wien" /> <Postcode Postcode="LSP-123" /> </Address> </Contact> <Contact> <id>2</id> <Address> <City City="Toronto" /> <Postcode Postcode="LKT-947" /> </Address> </Contact> <Contact> <id>3</id> <Address> <City City="Wien" /> <Postcode Postcode="LSP-123" /> </Address> </Contact> </Contacts> Desired

XSLT Validate and Concatenate Multiple Variables

一个人想着一个人 提交于 2019-12-05 20:25:46
I have to validate and concatenate multiple variable after validating them. <xsl:variable name="val1" select="//xpath"/> <xsl:variable name="val2" select="//xpath"/> <xsl:variable name="val3" select="//xpath"/> <xsl:variable name="val4" select="//xpath"/> <xsl:variable name="val5" select="//xpath"/> Is there any template available for this or anyone can help me doing this. Update from comments I want to concatenate five values like this: Address, Address1, City, State, Zipcode . If Address is missing I'll get an output like this " , address1, city, state, zipcode ". I want to get rid of that

XSLT: find duplicates within each child

早过忘川 提交于 2019-12-05 20:06:18
I'm new to XSLT/XML. I have an XML file similar to this: <event> <division name="Div1"> <team name="Team1"> <player firstname="A" lastname="F" /> <player firstname="B" lastname="G" /> <player firstname="C" lastname="H" /> <player firstname="D" lastname="G" /> </team> <team name="Team2"> <player firstname="A" lastname="F" /> <player firstname="B" lastname="G" /> <player firstname="C" lastname="H" /> <player firstname="D" lastname="I" /> </team> </division> </event> I'm trying to write a XSL Transformation (to use with xsltproc) to give me the names of players with the same lastname within the

How to display thumbnails from harvested items in DSpace?

南楼画角 提交于 2019-12-05 18:38:38
I am trying to display the thumbnails from harvested items. The settings I have for the harvesting options is Harvest metadata and references to bitstreams (requires ORE support) . When looking for the code on how DSpace displays the filenames and file sizes of the bitstreams of the harvested items in simple view, I found that in https://github.com/DSpace/DSpace/blob/dspace-6.1/dspace-xmlui-mirage2/src/main/webapp/xsl/aspect/artifactbrowser/item-view.xsl#L375-L378 <!-- Special case for handling ORE resource maps stored as DSpace bitstreams --> <xsl:when test="//mets:fileSec/mets:fileGrp[@USE=

how to convert xslt version 2.0 to version 1.0

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 16:48:06
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

Converting decimal hours to hours minutes and seconds

﹥>﹥吖頭↗ 提交于 2019-12-05 13:03:59
Is there a more elegant solution to the following in xslt 1.0? I understand there are built in functions to xslt 2.0. I'm taking a number in decimal hours and need to represent it as HH:MM:SS. At the moment I have the following which functions well. <xsl:variable name="decimal_hours" select="pre_lab_cost div pre_labour_rate"/> <xsl:variable name="decimal_minutes" select="number(concat('0.',substring-after($decimal_hours, '.')))*60"/> <xsl:variable name="decimal_seconds" select="number(concat('0.',substring-after($decimal_minutes, '.')))*60"/> <xsl:value-of select="concat(format-number(floor(

using XPath to select contiguous elements with a certain attribute value

我只是一个虾纸丫 提交于 2019-12-05 11:41:06
I have XML like this: <span>1</span> <span class="x">2</span> <span class="x y">3</span> <span class="x">4</span> <span>5</span> <span class="x">6</span> <span>7</span> <span class="x">8</span> What I want is to use an XSLT stylesheet to put the contents of all elements whose class attribute contains x into one <x> element. So the output should be like this: 1 <x>234</x> 5 <x>6</x> 7 <x>8</x> (or, ideally, 1 <x>2<y>3</y>4</x> 5 <x>6</x> 7 <x>8</x> but that's a problem to tackle when I've solved this one.) This is the relevant fragment of my XSLT: <xsl:template match="span[contains(@class,'x')