xslt-2.0

How do i check if a node is a child of another node?

I want to get all "generateId" values of the text nodes which are a child of a specific node whose attribute "id" value is known. I can i test for this condition using XSL? ...

What is the difference between as="element()+" and as="element()*" in XSL?

What is the difference between using as="element(data)+" and as="element(data)" in xsl:variable. The below XSL solution works if use "+" but not when i use "". Can some one clarify. ...

How do i select all the text nodes within a specific element node using XSL?

How do i select all the text nodes within a specific element node using XSL? Input xml: <node1 id="1"> <node2 id="2"> <node3 id="3" /> <node4 id="4"> <node5 id="5">Text node1</node5> <node6 id="6">Text node2</node6> </node4> </node2> <node7 id="7">Text node3 <node8 id="8">Text node4</node8> <node9 id="9">Text node5</node9> ...

How do i modify the text content within a specified set of nodes using XSL?

I have a list of node ids. I want to append "-Selected" to all the text nodes within the given set of node ids. Please let me know how we can achieve the same using XSL? Input: <node1 id="a"> <node2 id="b"> <node3 id="c">Text node0</node3> <node4 id="d"> <node5 id="e">Text node1</node5> <node...

How to retrieve the id attribute of the root node of a xml using XSL?

How to retrive the id attribute of the root node of a xml using XSL? ...

How to select saxon TransformerFactory in Java

In my web application I need to use Saxon TransformerFactory to use XSLT 2.0 but I can't use setProperty method because I haven't this right on the web server and there is a Security Manager. So i have read that it's possible to do this: Use the Services API (as detailed in the JAR specification), if available, to determine the clas...

Why does Saxon evaluate the result-document URI to be the same?

My XSL source document looks like this <Topology> <Environment> <Id>test</Id> <Machines> <Machine> <Id>machine1</Id> <modules> <module>m1</module> <module>m2</module> </modules> </Machine> </Machines> </Environment> <Environment> <Id>prod...

How do I create Variables in XSLT that are not document fragments?

Consider the following XSLT 2.0 template <xsl:template match="/"> <xsl:variable name="var1"> <elem>1</elem> <elem>2</elem> <elem>3</elem> </xsl:variable> <xsl:text>var1 has </xsl:text> <xsl:value-of select="count($var1)"/> <xsl:text>elements. </xsl:text> <xsl:variable name="var2" sele...

Pattern Matching with XSLT

I'm trying to match a pattern into a string in XSLT/XPath using the matches function, as follows: <xsl:when test="matches('awesome','awe')"> ... </xsl:when> However, in both Firefox 3.5.9 and IE8, it doesn't show up. IE8 tells me that "'matches' is not a valid XSLT or XPath function." Is this due to XSLT 2.0 not being supported, an...

Read a remote zipped xml with just XSL

Hello there I want to know if it's possible for an XSLT file to read data from an XML located within folders of a remote zip(from the server at work), without any external processors (saxon and so forth) and without downloading it. Failing that, I'll resort to just reading the information from the zip... which brings me to my other (n...

xslt help - remove empty tags and replaces * with empty tags

Hi, I am having a problem while doing some XSLT pre-processing in my java program. We get an asterisk (*) from a mainframe program when it wants to blank out a value, which my java process has to treat like a blank or empty tag. So we apply an xslt to the input before my jaxb process. We are applying this xslt : <xsl:stylesheet vers...

XSLT2 format-dateTime - AM/PM without dots/periods

Hi, This is a question for XSLT 2 format-dateTime function. Please can anyone tell me how to make A.M./P.M. display with not dots/periods (AM/PM)? <xsl:variable name="ampm" select="format-dateTime(DATE, '[PN]')"/> The below code returns blank? <xsl:value-of select="replace($ampm,'.','')"/> Thanks, Will ...

XSLT 2.0 regex question (opening and closing elements on different matches)

I've simplified the problem somewhat, but I hope I've still captured the essence of my problem. Let's say I have the following simple XML file: <main> outside1 ===BEGIN=== inside1 ====END==== outside2 =BEGIN= inside2 ==END== outside3 </main> Then I can use the following the XSLT 2.0: <?xml version="1.0" encodin...

XSLT: Finding last occurance in a string

Given a form number like: ABC_12345_Q-10 I want to end up with: ABC12345 So I need to find the position of the second underscore Note that there is not a standard pattern or length to any of the "sections" between the underscores (so I cannot use substring to simply eliminate the last section). xPath 2.0 solutions ok ...

Complex XSL Transformation

Hi, I am still a beginner with XSLT but I am having a difficult task in hand. I have a non-xml file which needs to be transformed. The format of the file is a s follows: type1 type1line1 type1line2 type1line3 type2 type2line1 type2line2 type3 type3line1 type3line2 types (type1, type2, ...) are specified using certain codes which don...

Strip leading spaces only

Given element: <comments> comments go here </comments> How can I strip what may be multiple leading space characters. I cannot use normalize space because I need to retain newlines and such. XSLT 2.0 ok. ...

Two phase processing: Do not output empty tags from phase-1 XSLT 2.0 processing

I have some complex XSLT 2.0 transformations. I'm trying to find out if there is general purpose way to ensure that no empty tags are output. So... conceptually, a final stage of processing that recursively removes all empty tags. I understand this could be done by a separate XSLT that did nothing but filter out empty tags, but I need to...

xsl:character-map to replace special characters

Given an element with a value of: <xml_element>Distrib = SU &amp; Prem &amp;lt;&amp;gt; 0</xml_element> I need to turn '&'amp;lt; '&'amp;gt; into '&'lt; '&'gt; (forgive the tick marks around the ampersands above, I couldn't get it to format right) because a downstream app requires it in this format through...

Gobal counter in XSLT or alternative solution?

This is my Source-XML. It is originally a Word-ML which have been reduced to an own structure. Elements with name "aaa" can have any kind of name. The problem is the handling of footnotes: <root> <doc> <comment>text text text <footnote id="1" > text text text</comment> <aaa>text text text</aaa> <aaa>text text text<footnote...

Need to write a XSLT that will transform the XML in below format

Source XML :---I have multiple Owner with same and different value and has different contract number. <?xml version="1.0" standalone="yes"?> <NewDataSet> <Table1> <Owner>1</Owner> <Contract_Number>3</Contract_Number> </Table1> <Table1> <Owner>1</Owner> <Contract_Number>4</Contract_Number> </Table1> ...