xslt

XSLT include and document('') collision

I have two XSLT file A.xslt and B.xslt, where A.xslt includes B.xslt. A.xslt <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:my="my_namespace"> <my:data>This is A.xslt</my:data> <xsl:include href="B.xslt"/> <xsl:template name="my_template"> <xs...

XML 2 XML using XSLT

Hi, I learned about XSLT and XPath at w3schools,but it's not exactly what I wanted.. There are only examples about transforming XSLT 2 HTML, this is pretty easy,but I need a XML 2 XML transformation and can't find a good tutorial with examples...I downloaded MSXSL.exe but can't find exempls about using it to transform XML... Can anyone w...

How to set XSLT variable to contain exact xml data

Hi! I wonder how to store xml data from one variable in another. This works ($oldvariable contains xml data): <xsl:variable name="newvariable" select="$oldvariable"/> But this does not work (probably because of some obvious reason for an experienced XSLT-coder): <xsl:variable name="newvariable"> <xsl:copy-of select="$oldvariable"...

XSLT namespace axis seems not to work

I have the following xslt: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:my="my_namespace"> <xsl:template match="/"> <xsl:value-of select="document('')/xsl:stylesheet/namespace::my"/> </xsl:template> </xsl:stylesheet> ant it always returns an empty...

XSL Transform XML

Hi all, I have some xml in the following format: <fileExport> <rows> <row id="0"> <columns> <column id="0"> <name>Date Time</name> <value>2010-10-2 23:00:00 GMT</value> </column> <column id="1"> <name>Primary</name> <value>100.1</value> </column> ...

XSL: removing preceding folders on image path

I want to remove preceding './' and first folder if it is not named 'screenshots' So from <image href="./folderx/screenshots/page1.png"> <image href="./screenshots/page2.png"/> <image href="./views/screenshots/table/screenshots/page3.png"/> to <image href="screenshots/page1.png"> <image href="screenshots/page2.png"/> <image href="...

Transform &amp; in XSLT?

Hello Stackoverflow! I'm relatively new to XSLT. I've come across an issue that I don't know how to get around. I have an pretty large XML document that I am trying to transform to into another smaller, refined XML document. The large XML document has this style: <Property> <name>Document name</name> <value>SomeValue</value> ...

xslt on distict nodes?

I have the following schema: <parent> <child id="1" name="Child 1 Version 1" /> </parent> <parent> <child id="2" name="Child 2 Version 1" /> </parent> <parent> <child id="1" name="Child 1 Version 2" /> </parent> That I want to only handle the last node for each id. Below is what I have tried based on some reading: <xsl:for-ea...

Using XSLT Apply-Templates to conditionally select nodes

Let's say I have an xml document like this: <director> <play> <t>Nutcracker</t> <a>Tom Cruise</a> </play> <play> <t>Nutcracker</t> <a>Robin Williams</a> </play> <play> <t>Grinch Stole Christmas</t> <a>Will Smith</a> </play> <play> <t>Grinch Stole Christm...

XSL:Docbook2Dita not maintaining <xref>

Im using the docbook2dita.xsl from the DITA open toolkit (although I had to modify it to xsl version 2.0) To convert my .xml files orginally created in docbook over to DITA now. A weird issue that I'm running into is the tags' contents are not being preserved: Breadcrumb <para xreflabel="New Consent Type" id="manageNewConsentTyp...

Conflict by combining jQuery Accordion with GallerificPlus

Hi All I'm trying to combine the official jQuery accordion plugin with another JQ plugin called 'GallerificPlus' (Gallerific & Lightbox in 1). Unfortunately it doesn't work for me. The GallerificPlus is the one that doesn't work, the accordion works fine. Firebug reports no errors, so this could be anything. It's really frustrating. ...

XSL Match Element based on a Value

Hello...I am transforming an XML where I am supposed to locate a particular Element (based on the attribute value) and update the Element and its child attributes. The sample XML file is as below. <?xml version="1.0" encoding="utf-8"?> <Configuration> <Environments> <Environment id="Master"/> <Environment id="Deve...

XSLT copying without xsl:copy-of

I've got some *.xml with elements like : <app-method name="leave-accrual-status-details" kind="enquiry"> <title>...</title> <required-roles> <role name="authenticated"/> </required-roles> <asd> <param name="..." datatype="dt:int" control="hidden" call-kind="..." data-kind="..."/> </asd> <data-engine s...

how to fill text templates using xslt

I have an XML file with information, for example: <letter> <name>Test</name> <age>20</age> <me>Me</me> </letter> And then I have an text template like: Dear $name, some text with other variables like $age or $name again greatings $me When using xslt to transform the XML to the plain text letter I can use something like: <x...

max value of attribute

I want to change the values of the @page attributes of <line/> that are descendants of <section type="cover"/> to (max(@page) + 1) of <section type="contents"/>. Basically I need the page number for the cover section to be 1 higher than the last numeric page number of the contents section. Note: <line/> nodes are not always siblings, ...

Trim whitespace from parent element only

I'd like to trim the leading whitespace inside p tags in XML, so this: <p> Hey, <em>italics</em> and <em>italics</em>!</p> Becomes this: <p>Hey, <em>italics</em> and <em>italics</em>!</p> (Trimming trailing whitespace won't hurt, but it's not mandatory.) Now, I know normalize-whitespace() is supposed to do this, but if I try to a...

Update XML using XSLT in C# - How to update the same file

My requirement is to update an XML file (some elements identified via a parameter, with new attribute values again identified via a paramenter). I am using XSLT to do the same via C# code. My code is as below: XslCompiledTransform xslt = new XslCompiledTransform(); xslt.Load(f_Xslt); XmlReader xr = XmlReader.Create("SourceXML.xml")...

XSLT - rearrange all child elements under the first parent element

I need to rearrange all the the child elements of an XML Document underneath the first Parent (and discard all other parent info) In the example below, I need all 4 child elements under Parent[ParentField=1] and discard Parent[ParentField=X] <xml> <Parent> <ParentField>1</ParentField> <Children> <Child> ...

How to add top level element to XML using XSLT?

I have a simple XML, that I want to add a new root to. The current root is <myFields> and I want to add <myTable> so it would look like. <myTable> <myFields> . . </myFields> </myTable> ...

XSL Writing html code directly in docbook

I am new to docbook, but can not find a decent way to write some pieces of html code directly in the docbook xml structure. The best I could find was dbhtml-include, but it requires a separate html file to parse. Is it possible to write a few html lines directly ? What I am actually trying to do is to write math with mathjax inside do...