xslt

XSLT - Problem with foreach and incremented attribute name

I'm using XSLT and would like to transform this: <attr> <header name="UpdateInformation1"> <detail name="info">blah</detail> </header> <header name="UpdateInformation2"> <detail name="info">blah2</detail> </header> ...other headers with different names... </attr> To this: <UpdateInformation> <info...

XSLT: Converting a structure of items based on attribute values

Can somebody help me with the following problem, here is the input XML, the XSLT I'm using and the expected output. Actually I know it is because of unique generateid not getting generated this xslt failing to generate desired output, but I don't know where that code should be inserted. XML: <item id="N65537" text="catalog"> <item id...

What's the difference between XSL Pattern and XPath in syntax?

I'm updating codes to use MSXML6.0 from MSXML3.0. However, I noticed that, for MSXML3.0, the default "SelectionLanguage" is "XSL Pattern", while MSXML6.0 only support XPath. I have concerns that this change would introduce differences in the query syntax. Can somebody list the difference of syntax between these two syntax? ...

Transforming a sequence of tags using XSL

I'm kind of new to using XSL. I'm trying to convert an XML file into another XML file with a different structure using XSL. The input section of the XML goes like this: <tag> <Keyword>Event: Some Text</Keyword> <Keyword>Group: Some Text</Keyword> <Keyword>Other: Some Text</Keyword> </tag> I would like the desired output to...

xsl:include not working from a Firefox extension

I am developing a Firefox extension that uses XSL transformations. I have been using XSLTProcessor without problems until I needed to do an xsl:include from the XSL stylesheet. When I import the XSL stylesheet that uses an xsl:include, Firefox gives an error: Error: Component returned failure code: 0x80600001 [nsIXSLTProcessor.im...

String comparison in XSLT

When I call this template I get the following results. 155IT Matches 155OO 155OO Matches 155OO 155PP The XML I am processing does have three rows and those are the values, but why is the test returning true for the first two and false for the last one? How should I be doing the string comparison? <?xml version="1.0" encoding="UTF-8"?...

Parsing iCalendar data with XPath/XSLT

I am working with a XML driven CMS, and before I run off and either write or implement a module that parses the iCal format, I was wondering if there was any way to parse it using just XSLT or ideally just an XPath expression, as this is a built in function of the CMS. ...

Give parent elements a class when children is active with XSLT

Until recently XSLT was completely new to me, and I've been working on a menu/submenu in XSLT for a little while with a danish CMS called Dynamicweb. I don't know if this is a Dynamicweb specific question or a XSLT related question, but I'll ask anyway. My current XSLT document looks like this: <xsl:template match="//Page"> <xsl:p...

XSLT deepening content structure

given the following structure: <TITEL1>...</TITEL1> <p>..</p> <TITEL2>...</TITEL2> <TITEL3>...</TITEL3> <TITEL3>...</TITEL3> <P>...<P> is there a way to get to this: <TITEL1> <TITEL>...</TITEL> <p>...</p> <TITEL2> <TITEL>...</TITEL> <TITEL3> <TITEL>...</TITEL> <P>...</P>...

XPath union operator and context

I have following: <xsl:for-each select="/ROOT_NODE/NODE_1/NODE_11/LOCALE[CO &gt;= 8] | NODE_2/NODE_22/OCA"> </xsl:for-each> two questions: I need to confirm what is the context for NODE_2 in relation to /ROOT_NODE tree above. I'm thinking /ROOT_NODE/NODE_1/NODE_11/NODE_2. Is this correct? What will be the context node insi...

Xsl: Grouping and removing duplicate items

Given the following XML: <interface name="Serial1/0"/> <interface name="Serial2/0.0"/> <interface name="Serial2/0.1"/> <interface name="Serial3/0:0"/> <interface name="Serial3/0:1"/> I am trying to produce the following output: <interface name="Serial1/0"> <unit name="Serial1/0"/> </interface> <interface name="Serial2/0"> <unit n...

Is it possible to detect the presence of a (xml) tag using XSLT ?

I am suppose to test the presence of a tag and create a new node according to the result .. This is the input XML : <root> <tag1>NS</tag1> <tag2 id="8">NS</tag2> <test> <other_tag>text</other_tag> <main>Y</main> </test> <test> <other_tag>text</other_tag> </test> </root> And the required output XML i...

XSLT multiple replacing

I have an XML document, something like <root> <item>_x0034_SOME TEXT</item> <item>SOME_x0020_TEXT</item> <item>SOME_x0020_TEXT_x0032_</item> </root> I'm exporting it to HTML, but I have problems replacing escape characters. I have found several templates in the web to do text replacing but they all are similar to this: <xsl:tem...

Simple XSL transform.

OK, its Friday afternoon and I need to get this done: The following xml needs to be transformed: <?xml version="1.0" encoding="UTF-8"?> <ProfiledSettings> <PropertySet File="properties.txt"> <Property Name="scheduler.time">19h30</Property> </PropertySet> <PropertySet File="properties2.txt"> <Property Name="inclusions.filt...

How can I get the href attribute value out of an <?xml-stylesheet> node?

We are getting an XML document from a vendor that we need to perform an XSL transform on using their stylesheet so that we can convert the resulting HTML to a PDF. The actual stylesheet is referenced in an href attribute of the ?xml-stylesheet definition in the XML document. Is there any way that I can get that URL out using C#? I don...

How to Transform XML with XSLT using PHP in Wordpress

Right now I transform an XML document with an XSLT stylesheet using Javascript (in a Wordpress-based website). This works fine in Firefox and Chrome, but not in IE. Plus, if Javascript is not enabled, nothing would show up. So, my goal is to do the XML/XSLT transformation to XHTML on the server, not the client, preferably using PHP. I'...

xslt grab value from other node

I have two xslt dynamic drop down boxes and need a test statement that will test if the other one has been used. <xsl:template match="cat"> <xsl:choose> <xsl:when test = (if dog has already been selected) <select id="selectCAT"> <option value="" onchange="submitCAT()"> <option value="shorthair"> ...

'charset=UTF-16' is missing in the tranformation result with MSXML4.0

Hello Everyone, I have some problems about "charset" in the transformation result with different versions of MSXML. The code below will transform XML to HTML with MSXML3.0 Dim xmlDoc As New MSXML2.DOMDocument xmlDoc.async = False Dim strXML As String strXML = "<Results><ElapsedTime>3000</ElapsedTime></Results>" xml...

XML to XML using XSL Problem

I'd like to convert an XML file into another XML file with a different structure using XSL and I'm kindda new to XSL. The input section of the XML goes like this: <set> <object> Value </object> <name> Value </name> <tag> <event> Value </event> <group> Value </group> <other> Value <...

Debugging by outputting the full XML of a variable in xslt using xml:message

I have a variable called $statuses. I want to output the full xml rather than just the values in the nodes so I tried to do the following:- <xsl:message>Contents of the nodeset_statuses:- <xsl:copy-of select="$statuses"/> </xsl:message> However, this only outputs the values in the nodes in the XML which is not what I want. I want...