xslt

Manakin: where to find a tutorial

Hi, maybe you can help me here, although I know the chances are low but I'm getting desperate :). I'm working with Dspace and Manakin and I'm having some problems with the themes. For example, to show an specific issue, I'm trying to overwrite the content display: <xsl:template match="mets:fileGrp[@USE='CONTENT']"> ...

xslt dynamically start and close tags

I want to do something similar to the following: <xsl:for-each select="Item"> <xsl:if test="postion()=1 or position()=7> <ul> </xsl:if> <li>An Item</li> <xsl:if test="position()=2"> </ul> </xsl> </xsl:for-each> </ul> This will not work however because xslt views the unclosed <ul> within the if statement as invalid....

PHP/XSLT multiple instances of the same quertystring

My backend accepts comma delimited id values "11,12,13". On the front end I have a check list that allows multiple selection and posts the following. someurl.com?id=11&id=12&id=13 How do I use $_GET for multiple instances of ID, format it into a comma seperated string? Or alternatively, is there a better way to force checklists to subm...

XSLT Grouping and subgrouping

I have the following code: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:output method="html" /> <xsl:key name="categories" match="Category" use="." /> <xsl:key name="clients" match="Category" use ="Category/Client" /> <xsl:template match="/"> <ul id="red" class="treeview-red">...

SVG to black-and-white

Hi, I would like to be able to convert SVG documents to black and white. My try is the following Makefile script using 'sed' : %.bw.svg: %.svg sed '/stroke:none/!s/stroke:[^;\"]*/stroke:black/g' $< > $@ This works for lines etc but not for fillings. Basically if the stroke is not invisible (none), then I convert it to black. I wou...

Flatten XML to CSV (VB.NET / C#.NET / XSLT)

Hi I wonder if somebody can help me flatten an XML file to CSV format. I have worked on this all day today, and although I've found some simple examples, my issue is slighlty different. Please see example below... Example XML: <data> <val_A>1</val_A> <val_A>2</val_A> <val_B>3</val_B> <val_B>4</val_B> <val_C> ...

Variable scope in XSLT

Hi, I am having an issue trying to figure out var scoping on xslt. What I actually want to do it to ignore 'trip' tags that have a repeated 'tourcode'. Sample XML: <trip> <tourcode>X1</tourcode> <result>Budapest</result> </trip> <trip> <tourcode>X1</tourcode> <result>Budapest</result> </trip> <trip> <tourcode>X1</tourcode> <resul...

Converting XML format

We have an issue where we have an XML feed leaving our system and a client needs to be able to import this feed into their system but they require the XML file to be in a different format. For a number of reasons its not possible for either of us to alter our format. I was thinking then that it would make sense for us to build some kind ...

what is wrong in this code

<xsl:apply-templates select="xslTutorial"/> </xsl:template> <xsl:template match="xslTutorial"> <p> <xsl:for-each select="number"> <xsl:value-of select="."/>+ </xsl:for-each> = <xsl:value-of select="sum(number)"/> </p> </xsl:template> in the result there is a"+" that i don't it...

what is wrong in this code (xslt code)

This is my xslt code <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/> <xsl:template match="xslTutorial"> <xsl:apply-templates select="xslTutorial"/> </xsl:template> <xsl:template match="...

How can I stop IIS 7 locking .XSLT file in C#

I have the following lines of code: xslt.Load(XmlReader.Create(new FileStream(@"C:\website\TransList.xslt", System.IO.FileMode.Open))); xslt.Transform(mydoc.CreateReader(),null, sw); It works fine, if I stop the project and launch it again, I get the following error: [System.IO.IOException] = {"The process cannot access the file 'C:...

XSLT: Get the closest item with a specified value defined? (Sitecore)

I have the current structure; Item 1 - Subitem 1 - Subitem 2 - Subitem 3 - - Sub subitem 1 - - Sub subitem 2 - - Sub subitem 3 - - etc I have a field that is only defined on "Item 1". Let's call it 'Header'. When i am on "Item 1" its easy enough to extract this value, but what about when i am on the other items? Is there a way...

XSLT for MS Test code coverage result file

Do you know some nice XSLT for transforming the code coverage XML output from the Visual Studio (I'm using the 2010 Ultimate Beta) into an HTML report that I could put on a webpage ? I have found an article which could get me started but their example is just a simple one that doesn't contain all the hierarchical drill-down information a...

Can I use 'and' operator in xsl for-each?

Simply can I execute the following in xsl? <xsl:for-each select="trip/instance[.!=''] and trip/result[.!='']"> </xsl:for-each> Q: When I use select="" in for-each does it change the scope of my selector for the code I use inside for-each? ...

Concatenating XML

I have three files of xml <step> <Products> <Product UserTypeID="Country"> <Name>Cyprus</Name> <Product UserTypeID="Resort"> <Name>Argaka</Name> <Product UserTypeID="Property"> <Name>Villa Tester</Name> </Product> </Product> <Product UserTypeID="Reso...

How to set XSLT in C# to ignore error

Is there a way to turn off XSLT compile errors when creating HTML from an xsl stylesheet. For instance, for every html tag is expecting a closing tag. Now the final doc does have closing tags but it is within muliple templates where one would have the open, the last would close it. Is there a way to surpress the xslt compile error? ...

Error accessing w3.org when applying a XSLT

I'm applying a xslt to a HTML file (already filtered and tidied to make it parseable as XML). My code looks like this: TransformerFactory transformerFactory = TransformerFactory.newInstance(); this.xslt = transformerFactory.newTransformer(xsltSource); xslt.transform(sanitizedXHTML, result); However, I receive error for every doctype ...

How do I pretty print an XSLT result document with removed source elements?

I have a source XHTML document with elements in multiple namespaces that I am transforming into an HTML document (obviously with no namespaces). In my XSL templates I only match elements in the XHTML namespace to remove non-HTML-compatible elements from the result tree. However, in the output, while those elements are gone, the whitespac...

Escaping XSLT regular expression

I am having some trouble escaping a validation expression within a regular expression validator in XSLT. <asp:RegularExpressionValidator ID="regValEmail" ErrorMessage="..." runat="server" ValidationGroup="Store" ValidationExpression="[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\....

How do I convert strings starting with numbers to numeric data in XSLT?

Given the following XML: <table> <col width="12pt"/> <col width="24pt"/> <col width="12pt"/> <col width="48pt"/> </table> How can I convert the width attributes to numeric values that can be used in mathematical expressions? So far, I have used substring-before to do this. Here is an example template (XSLT 2.0 only) that shows...