xslt-1.0

Splitting an xml based on the contents of xml either using java or xslt

跟風遠走 提交于 2019-12-06 12:38:51
I have a requirement,consider the below xml data Input1.xml <Envelope> <Notification> <Data> <Input>ABCDEFGHIJKLMN</Input> <Output>RESPONSEDATA</Output> </Data> <Data> <Input>OPQRSTUVWXYZ</Input> <Output>NEXTDATA</Output> </Data> <Data> <Input>ALPHABETS</Input> <Output>SOMEDATA</Output> </Data> </Notification> </Envelope> Now I want 3 output xmls with the response as shown below the file name to have first 6 characters ofABCDEFGHIJKLMN as output file name to have as shown below (FILE1)->ABCDEF.XML <Output>RESPONSEDATA</Output> (FILE2)->OPQRST.XML <Output>NEXTDATA</Output> (FILE3)->ALPHAB.XML

When test hanging in an infinite loop

不问归期 提交于 2019-12-06 12:24:59
I'm tokenising a string with XSLT 1.0 and trying to prevent empty strings from being recognised as tokens. Here's the entire function, based on XSLT Cookbook : <xsl:template name="tokenize"> <xsl:param name="string" select="''" /> <xsl:param name="delimiters" select="';#'" /> <xsl:param name="tokensplitter" select="','" /> <xsl:choose> <!-- Nothing to do if empty string --> <xsl:when test="not($string)" /> <!-- No delimiters signals character level tokenization --> <xsl:when test="not($delimiters)"> <xsl:call-template name="_tokenize-characters"> <xsl:with-param name="string" select="$string"

XSLT - Creating Dynamic Grid

妖精的绣舞 提交于 2019-12-06 12:06:58
问题 I am creating dynamic table(grid) using xslt, XSLT : <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="yes" indent="yes"/> <xsl:key name="RowAttribsByName" match="Row/@*" use="concat(generate-id(..), '|', name())"/> <xsl:variable name="vColNames" select= "/*/Columns/*[not(@Hidden = 'true')]/@Name"/> <xsl:template match="/*"> <table border="1"> <tr> <xsl:apply-templates select="Columns/*"/> </tr> <xsl:apply-templates select="Rows

XSLT define a variable and check if it exists after

跟風遠走 提交于 2019-12-06 10:55:21
I am attempting to transform an XML document. First, I am defining a global variable: <xsl:variable name="foo"><xsl:value-of select="bar"/></xsl:variable> Now there is a chance that the XML I'm transforming has <bar>some data</bar> defined. There is also a chance that it is not defined. Once I declare the global variable below, I'm trying to output the following if it is defined: <foo>DEFINED</foo> and if it's not defined: <foo>NOT DEFINED</foo> I am using <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> What's the best way of going about this? Since you're using

XSLT to lookup values in one XML and replace in another XML file

寵の児 提交于 2019-12-06 09:59:35
One of the products we work with is able to output configuration information as XML, but, in that output file, instead of including actual host identifiers (names), they use a kind of GUID reference for each of the identifiers. I have made an XML file that contains the "mapping" between the host identifiers GUIDs and the actual host identifiers(lookup), and I want to implement an XSLT that will go through the configuration file and replace all of the host identifier GUIDs with the host identifier names, which it would lookup from the other XML file I made (lookup.xml). Here's what the lookup

How to get only business days between two dates in xslt 1.0

青春壹個敷衍的年華 提交于 2019-12-06 09:40:13
I need help to count only business days (i.e excluding Saturday and Sunday ) between two dates in xslt 1.0 count only business days (i.e excluding Saturday and Sunday ) between two dates in xslt 1.0 If it can be assumed that the two given dates will not fall on Saturday or Sunday, you could use the method shown in the following example: XSLT 1.0 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="/"> <output> <workdays> <xsl:call-template name="duration-in-workdays"> <xsl

Conditionally wrap content with XSL 1.0

喜夏-厌秋 提交于 2019-12-06 07:35:15
I am looking for a way to wrap content with xsl. This is a simplified example of what I am doing. Lot's of content ... is a significant amount of content, and the anchor tag is only used as an example. It could be a div or anything else. XML: <root> <attribution>John Smith</attribution> <attributionUrl>http://www.johnsmith.com</attributionUrl> </root> XSL: How I am currently doing it. This is adding a significant amount of xsl and I am sure there is a way to simplify. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <xsl:if test=

Concat Strings to numbers using Recursive

萝らか妹 提交于 2019-12-06 07:21:54
XML coding is given below <math> <mn> <mphantom>12</mphantom> </mn> </math> Output required: <?xml version='1.0' encoding='UTF-8'?> <math>|phantom1||phantom2|</math> XSLT tried: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:m="http://www.w3.org/1998/Math/MathML" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cl="http://xml.cengage-learning.com/cendoc-core" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink"> <xsl:output method="xml" encoding="UTF-8" indent="no" /> <xsl:strip-space elements="*" /> <xsl

How can I capture current or active locale in DSpace XMLUI?

流过昼夜 提交于 2019-12-06 05:40:16
I have this setting in dspace.cfg webui.supported.locales = en, fr, zh . I wonder why I can't get the active or current locale if I use: <xsl:value-of select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[@element='page'][@qualifier='currentLocale']"/> in my item-view.xsl ? Viewing the page eg http://localhost:8080/DRI/handle/123456789/10476?locale-attribute=fr , it is obviously there in: <metadata element="page" qualifier="currentLocale">fr</metadata> Am I missing something? Apparently, declaring this in a variable in the global-variables.xsl eg <xsl:variable name="active-locale" select="

Checking for a duplicate element in the OUTPUT

假装没事ソ 提交于 2019-12-06 04:31:21
问题 I've got some XML, for example purposes it looks like this: <root> <field1>test</field1> <f2>t2</f2> <f2>t3</f2> </root> I want to transform it with XSLT, but I want to suppress the second f2 element in the output - how do I check inside my template to see if the f2 element already exists in the output when the second f2 element in the source is processed? My XSLT looks something like this at present: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output