xslt

How get first name initial and last name in XSLT

﹥>﹥吖頭↗ 提交于 2020-01-25 10:05:06
问题 I want yo get the first name initial and last name. Input : <root> <ele name="Samp Huwani"/> <ele name="Gong Gitry"/> <ele name="Dery Wertnu"/> </root> Output <names>S Huwani</name> <names>G Gitry</name> <names>D Wertnu</name> Tried Code: <xsl:template match="root/name"> <names> <xsl:value-of select="@name" /> </name> </xsl:template> I am using XSLT 2.0 . Thank you 回答1: With the given example, you could use: <xsl:template match="/root"> <xsl:copy> <xsl:for-each select="ele"> <name> <xsl:value

Adding some new conditions to the XSLT-recursion

倖福魔咒の 提交于 2020-01-25 06:42:43
问题 Here is the existing XML-source and XSLT-transformation code which restores all parent-child interconnetion chain. The algorithm does the correct work, but need to take into account new additional conditions; plus output "string" (or names) values have to take more formalized, proper form. ======= base source <root> <document ID-1="galaxyID" ID-2="NULL" ID-3="111" SHORTNAME="gal" NAME="Milky Way"/> <!-- this is parent's node --> <document ID-1="starID" ID-2="galaxyID" ID-3="222" SHORTNAME="st

XSLT replacing text in attribute value and text nodes

时间秒杀一切 提交于 2020-01-25 04:26:13
问题 I have an XML document that I'm trying to transform and do a string replace of certain values when that value occurs in either a text node or an attribute named message . My xsl file is below, but the main issue is that when the replace occurs in the message attribute, it actually replaces the whole attribute and not just the value of that attribute, so <mynode message="hello, replaceThisText"></mynode> becomes <mynode>hello, withThisValue</mynode> Instead of <mynode message="hello,

XSLT replacing text in attribute value and text nodes

不羁岁月 提交于 2020-01-25 04:25:59
问题 I have an XML document that I'm trying to transform and do a string replace of certain values when that value occurs in either a text node or an attribute named message . My xsl file is below, but the main issue is that when the replace occurs in the message attribute, it actually replaces the whole attribute and not just the value of that attribute, so <mynode message="hello, replaceThisText"></mynode> becomes <mynode>hello, withThisValue</mynode> Instead of <mynode message="hello,

How to transform xml to requested one

空扰寡人 提交于 2020-01-25 03:33:09
问题 I have an xml which I must transform it to another structure of xml. I tried many ways but no success. I need to use xslt 1.0. I asked a question but the format is changed after I asked. input: <?xml version="1.0" encoding="ISO-8859-1"?> <PersonBody> <Person> <D>Name</D> <D>Surname</D> <D>Id</D> </Person> <PersonValues> <D>Michael</D> <D>Jackson</D> <D>01</D> </PersonValues> <PersonValues> <D>James</D> <D>Bond</D> <D>007</D> </PersonValues> <PersonValues> <D>Kobe</D> <D>Bryant</D> <D>24</D> <

How to add a delimiter between each element in a for-each loop?

扶醉桌前 提交于 2020-01-25 02:49:05
问题 I am looping through each element in a list and outputting a certain value: <xsl:for-each select="properties/property"> <xsl:value-of select="name"/> </xsl:for-each> This simply outputs a concatenation of the name node of property. I want to add delimiter, such as ; between each element. How can this be done? I listed XSLT versions 1.0, 2.0 and 3.0 as functionalities might differ between different versions. 回答1: If you are using XSLT 2.0 or above, you can drop the xsl:for-each and just do it

Accessing previous xml values while validating the xml file from generated schema

笑着哭i 提交于 2020-01-25 00:09:19
问题 I am trying to write a dynamic xml schema that will validate an xml file against different sources depending on previous entries in the xml. I am currently generating an xsd schema using xslt and a spring beans file. This means I can set restrictions based on the spring config. I am having problems changing which bean is referenced depending on previous input. My (simplified) beans file (doesn't have to use spring, can just be plain xml if needed): <?xml version="1.0" encoding="UTF-8"?> <?xml

how can i merge these two xml files using xslt

余生颓废 提交于 2020-01-24 21:13:05
问题 Please i want to know how i can merge two xml files into one xml file using xslt. I have these both xml files that i want to merge into an xml file as shown in the expected output.I want to include the each node Hn from the second file to the corresponding block with same number in the file 1. file1: <Test> <R1> <Th1> here are some instruction. </Th1> </R1> <R2> <Th2> here are some instruction. </Th2> </R2> <R3> <Th3> here are some instruction. </Th3> </R3> </Test> file 2: <test1> <H1> here

Decoding base64 image data using xslt

六月ゝ 毕业季﹏ 提交于 2020-01-24 19:35:09
问题 I am trying to have a single xml and at most one xsl stylesheet, the contents of the xml file are like below <catalogue> <item> <item_id>1234</item_id> <item_desc>hi-fi sanio</item_desc> <price>12.50</price> <image>iVBORw0KGgoAAAANSUhEUgAAANIAAAAzCAYAAADigVZlAAA</image> </item> <item> <item_id>4614</item_id> <item_desc>lace work</item_desc> <price>1.50</price> <image>QN0lEQVR4nO2dCXQTxxnHl0LT5jVteHlN+5q+JCKBJITLmHIfKzBHHCCYBAiEw</image> </item> <item> <item_id>614</item_id> <item_desc>bicycle

Decoding base64 image data using xslt

偶尔善良 提交于 2020-01-24 19:35:05
问题 I am trying to have a single xml and at most one xsl stylesheet, the contents of the xml file are like below <catalogue> <item> <item_id>1234</item_id> <item_desc>hi-fi sanio</item_desc> <price>12.50</price> <image>iVBORw0KGgoAAAANSUhEUgAAANIAAAAzCAYAAADigVZlAAA</image> </item> <item> <item_id>4614</item_id> <item_desc>lace work</item_desc> <price>1.50</price> <image>QN0lEQVR4nO2dCXQTxxnHl0LT5jVteHlN+5q+JCKBJITLmHIfKzBHHCCYBAiEw</image> </item> <item> <item_id>614</item_id> <item_desc>bicycle