xslt

how to match the processing-instruction element in xslt ??

I have some processing-instructions elements inside my xml content, for example : <?legalnoticestart?> <?sourcenotestart?> <para>Content para</para> <?sourcenoteend?> <?literallayoutstart?> <para>body content </para> <?literallayoutend?> <?legalnoticeend?> How can i match these elements and get the content in the below required eleme...

How to count specific nodes in xml hierachy depends on condition in XSL

I'm writing a stylesheet in xsl (version 2.0) I want to know how could I count all nodes with a specific name although they're not siblings for example in the following xml I want to count the numbers of Products from type -Milk but from all shops. I want to know if there's a way to use the count function and not struggling with Recursio...

When dispalying in a table data with xsl table-layout:fixed tuncates the string

I'm using xsl to display xml. I'm displaying in a table which I want the width="100%" if I insert a regular text with spaces it automatically underlines and displays the whole test in a few lines. But---- when I'm using <table style="table-layout:fixed" width="100%"> <tr> <td width="30%"><xsl:value-of select="Title"/></td> <td widt...

Xslt newbee abs function ??

I am not a programmer, but am trying to transform some data. The data contained in my xml field "Source/End/Edgecode" looks like -000016 I want to remove the leading dash. I thought I could use abs or right, but I don't know the correct syntax. Thanks for any help... ...

How to replace double quotes with typographer's quotes (aka curly quotes)

I need to programatically replace "regular double quotes" with “typographer's quotes” My initial thought is something like this: <xsl:variable name="text"> <xsl:call-template name="replace-string"><!-- FYI: replace-string is a custom method that works like you would expect--> <xsl:with-param name="text" select="."/> ...

Where do I put an XSL function in an XSL document?

I have an XSL style sheet for which I need to add some custom string manipulation using an xsl:function. But I am having trouble trying to work out where to put the function in my document. My XSL simplified looks like this, <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:my="myFunctions" xmlns:d7p1="http://...

Is there a tool to assist in producing an XSL, which would translate XMLs described by one XSD to XMLs described by another XSD?

Dear ladies and sirs. I am new to XMLs/XSDs/XSLs. I have two XSDs. I wish to generate an XSL that would translate XML files complying with the first XSD to respective XML files complying with the second XSD. I reckon there are tools that automate this task, given some help from the human, of course. Do any of you know of such tools? ...

Making XSLT language independent

In my web application, I display the search results using XSLT. There are some hard coded text in XSLT file which I want to make language independent. XSLT: <xsl:if test="$IsEmpty"> <table cellpadding="5" cellspacing="0" border="1" style="width:100%;border-top-style:solid;border-bottom-style:solid;border-left-style:solid;border-right-...

Is it possible to include/exclude the XML Processing Instruction based on its presence in the source document?

I have to pass back information from a different source and can have a transformation in between, But depending on if the source document has the xml processing instruction, I have to pass it on and if it doesnt, I shouldnt pass it on. Input <?xml version="1.0" encoding="UTF-8"?> <Source/> Output <?xml version="1.0" encoding="UTF-8...

Exclude items who has a later date than the date of today

I have a question about XSLT. On a website i have a simple calendar, showing events who are going on in the future. But when an event is done, it should be removed from my list. By done i mean, that the date of the event is past the date of today. Every event have a date attached. Look at the folowing code: <xsl:for-each select="$cu...

How to use embedded EXSLT from XSLTProcessor?

XSLTProcessor::hasExsltSupport() returns true. Now what do I have to modify so I can use it? I have <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:date="http://exslt.org/dates-and-times" extension-element-prefixes="date"> Transformation what I'm tr...

time calculation in xslt

I am using xsl version 2.0 I have a time field that I need to add 1 to. I am getting a formatted number from the the below node: <xsl:value-of select="Master/End/Timecode"/> <xsl:text> The data in "Master/End/Timecode" looks like 01:00:00:00 basically time-- hours :minutes :seconds :frames the frames are a count from oo to 2...

XSLT templates nodes inheritence ?

Hi, I am looking to transform a input xml given below <profile name="default"> <color id="forecolor" value="blue"></color> <color id="backcolor" value="white"></color> <color id="bordercolor" value="black"></color> </profile> <profile name="error" parent="default"> <color id="forecolor" value="red"></color> </profile> <pro...

Displaying an XML file with XSL within an existing webpage

Hi, I'm trying to get an html page to display an XML file formatted with an XSL stylesheet. Whatever examples I see are either displaying it in a new page, with the XSL stylesheet taking care of the tags, but no examples where I can clearly see it being displayed as part of an existing webpage... I'm using a PHP script to generate the ...

PHP Warning in XSLTProcessor::importStylesheet() despite near empty XSL stylesheet

Hi, I'm trying to use the following code # LOAD XML FILE $XML = new DOMDocument(); $XML->loadXML( $exporteddatatransformed ); # START XSLT $xslt = new XSLTProcessor(); $XSL = new DOMDocument(); $XSL->load( 'xsl/'.$xsltemplatefileid.'.xsl', LIBXML_NOCDATA); $xslt->importStylesheet( $XSL ); <-- LINE 549 #PRINT print $xslt->tr...

XSLT functions and namespaces

I'm kind of new to XSLT, and I've gotten basic transformation done. Next I want to try out date manipulations, since my data will have timestamps. However, I can't seem to get any date functions to work, and it greatly frustrates me. I'm testing using Firefox 3.5, xsltproc 1.1.24, xalan 1.10, and XMLSpy 2009, and they all say that the fu...

How to display XML returned by SharePoint for web parts?

Lately I've been doing a lot of custom styling in SharePoint by modifying the XSL used to display various web parts. Knowing what the actual XML looks like, including which elements have actual values, really helps when working in the XSL. I've discovered a way to show this XML when using Ontolica web parts, but not when I'm using the ...

XML Summary using XSLT

I have a directory of XML files... for example: result.xml result2.xml result3.xml resultNth.xml (because there is an unknown amount of files) the schema in each result file would be the same essentially <Succeeded> <someStrongXMLObject> </someStrongXMLObject> </Succeeded> My Question is - c...

Randomly choose a node in XSLT

Hi all I have a question about some sort af random function in XSLT. I have an XML-file that very simplified look similar to this: <node id="1198"> <node id="1201"> <data alias="name">Flemming</data> <data alias="picture">1200</data> </node> <node id="1207"> <data alias="name">John</data> <data alias="picture">12...

create droplet app. to transform xml with xslt

I want to create a application, where you drop a xml doc on it, and an xslt transformation occurs using saxon as the transform engine. The result is a text file. I am doing this on a mac. Does anyone know where I could find a beginner tutorail to approach this?? Thanks, Ian ...