xslt

XSLT: Use of template tag variable and break condition in for-each loop

I am using an XSLT where I have created <xsl:template> tag which does some validation using an <xsl:for-each> statement and sets the value of <xsl:variable> or <xsl:param> to true or false. Is there any way to break the statement in for-each if condition is true? Can we use the value of Template variable or param from main calling rou...

XSL: Ignoring/stripping namespaces in secondary documents

I am writing an XSL template that pulls data from many secondary sources. An example secondary document looks like this: <toplevel xmlns:foo1="http://foo1"&gt; <path xmlns="http://foo1"&gt; <mytag>bar</mytag> </path> </toplevel> In the XSL, I am doing this: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Tr...

how to transform XML files before processing xinclude

Hi, I have numerous XML files that are organized into different directories. I need to combine them and transform the result using XSLT. So far, I have already done this except for one problem: some XML files need to be transformed first before it can be included into the result. xinclude seems to ignore the xml-stylesheet declaratio...

XML document within Sharepoint webpart codebehind

Hi, I am loading an XSLT file in c# sharepoint webpart code as below: string path = context.Request.MapPath("/_layouts/RSSWeatherXSL.xsl"); XslTransform trans = new XslTransform(); trans.Load(path); // loading xsl file The XSLT file is rather large around 134 lines. I need to reference images within the XSLT the path to wh...

Unique ID and multiple classes with XPath

Hi I'm using XSLT for displaying a ul menu containing li and a. I want the following: Find the first li a element and add the .firstitem class. Find the last li a element and add the .lastitem class. Find the active li a element and add the .active class. Add an unique ID to each li a element. (I.e. URL friendly menu text as ID). I...

Specifying zero padding with format-dateTime

I have the following in xslt <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:fn="http://www.w3.org/2005/02/xpath-functions" xmlns:xdt="http://www.w3.org/2005/02/xpath-datatypes"&gt; <xsl:output method="xml" version...

Number the nodes at the end of nested <xsl:for-each>

I have an XSLT transformation with several nested <xsl:for-each> and <xsl:apply-templates>. Now i need to number the nodes at the end of this for-each and apply-templates. Everything I tried just numbered the iterations on an level of for-each (e.q. 1,2,3,4,1,2,1,2,3,4 but I need 1,2,3,4,5,6,7,8,9,10) (I'm pretty inexperienced with XS...

XSLT: Matching Xpath attributes to attributes from for-each scope

I guess my problem is quite common, so there must be an easy solution. Consider the following xml snippet: <categories> <category name="cat1" /> <category name="cat2" /> <category name="cat3" /> <category name="cat4" /> </categories> <data> <catval name="cat2">foo</catval> <catval name="cat4">bar</catval> ...

How can I render custom XSL controls in my XSLT file with C#?

I'm using C# to translate a XML file to HTML with the use of XSLT. I use an Extension object to render my own code: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" xmlns:widget="urn:ser...

Storing HTML in datastore and Decoding during XSL transformation

I'm trying to store html object tags for video players in a datastore. This data will be serialized and passed back to client javascript where it will be transformed and displayed in the browser to show the video. I need to be able to htmlDecode the data so that it is evaluated properly in the browser. Any ideas how to accomplish th...

successor of msxsl.exe?

We intend to migrate our framework from msxml4 to msxml6. We where using msxsl.exe as yet. It seems to support only MSXML versions up to 4.0, as command line msxsl.exe -u version 6.0 tells me. Is there a successor of msxsl.exe? Any alternative command line processor? ...

xslt:if how to test for boolean values.

Hello, I cannot figure out a way to check if the value of an attribute is true or false. It's boolean, converted from dataset. When I select the value, I see it is either true or false, but my test does not get the expected behaviour. (it is always false.) I tried almost everything, this is my first xslt application, so help is apprecia...

Sorting only specific XML nodes

I need to sort only the <Transaction-Detail> nodes (by the <tran-id> child node) of the following file: <TransActDO clear="true" removed="false"> <stmt-reason-code>1001</stmt-reason-code> <Transaction-Detail clear="true" removed="false"> <txn-amt>788.20</txn-amt> <txn-description>New Purchase</txn-description> <tran-id>3...

Oracle XSL processor expanding namespaces

I am generating and validating XML and am experiencing a problem where Oracle expands the full namespace from the prefix. The source document may look like this: <pcy> <tList> <currTrn> <TXN_A>1</TXN_A> <TXN_B>2</TXN_B> ... the transform looks like this: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet v...

How to reformat XML with group-adjacent (XSLT)

I'm new in this XSLT-thing and I can't figure out how to this: This is a snippet from the xml i start with: <Article> <Bullettext>10,00 </Bullettext> <Bullettext>8,00 </Bullettext> </Article> <Article> <something>some text</something> </Article> <Article> <Corpsdetexte>Bulgaria</Corpsdetexte> <Bullettext>15,0 </B...

XSLT: format list with values for same attribute code on single comma seperated string

I want to merge the same node data by comma separator. How i can do this. Regards, Om ...

How to validate a Gateway entry in classic XML/XSD/XSLT ?

Hey they, I am currently working on a application dealing with a XML file. The XML file looks like this : <config> <ip>10.10.100.2</ip> <subnet>255.255.0.0</subnet> <gateway>10.10.1.1</gateway> </config> Now I am on validation. I use XSD. So my validation works fine with the IP element and Subnet Element. I done something like this...

xslt dropdown problems

I have a page with two drop down boxes created in a xslt. I am using onchange in both blocks to call a javascript function. If both drop downs are loaded on the page only the first drop down has a working onchange. I checked the view source code and it shows both onchange events. Does anyone have any idea how to fix this? ex: two dro...

xslt, sort by date - wrong date format, day first (ddmmyyyy)

Hello I would like to sort a list of 1500 files in XSLT 1. The list is similar to: 01052003.xls -> (translate to: 1th of May 2003) 25062004.xls -> (translate to: 25th of June 2004) 31032001.xls -> (translate to: 31th of Marts 2001) I can do a sort by name but since they are named ddmmyyyy sorting will be wrong. Can I somehow sort fi...

XPath: Query an attribute from a nodeset in a variable

Within an XSL sheet, I have a nodeset in a variable, $context. How do I properly query an attribute of the topmost node in $context? Obviously, if $context was the current node, I would just write "@attname", but it is not. Currently I do $context/../@attname which is doesn't look great to me. EDIT Ok, the data. Here is what I see in ...