Search Results

Search found 933 results on 38 pages for 'xslt'.

Page 2/38 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Overview of XSLT

    - by kaleidoscope
    XSLT (Extensible Stylesheet Language Transformations) is a declarative- XMLbased language used for the transformation of XML documents into other XML documents. Using XSLT , the original document does not changed; rather, a new document is created based on the content of an existing one. XSLT is developed by the World Wide Web Consortium (W3C).   Using XSLT we can transform source xml file into another xml file, word file or Excel file.    XSLT Functions : -   There are the following built - in XSLT functions :   Name Description current() Returns the current node document() Used to access the nodes in an external XML document element-available() Tests whether the element specified is supported by the XSLT processor format-number() Converts a number into a string function-available() Tests whether the function specified is supported by the XSLT processor generate-id() Returns a string value that uniquely identifies a specified node key() Returns a node-set using the index specified by an <xsl:key> element system-property() Returns the value of the system properties unparsed-entity-uri() Returns the URI of an unparsed entity   For more information –   http://www.w3schools.com/xsl/default.asp   Technorati Tags: Ritesh, Overview of XSLT

    Read the article

  • JQuery > XSLT Plugin > Component returned failure code: 0x80600011 [nsIXSLTProcessorObsolete.transfo

    - by Sean Ochoa
    So, I'm using the XSLT plugin for JQuery, and here's my code: function AddPlotcardEventHandlers(){ // some code } function reportError(exception){ alert(exception.constructor.name + " Exception: " + ((exception.name) ? exception.name : "[unknown name]") + " - " + exception.message); } function GetPlotcards(){ $("#content").xslt("../xml/plotcards.xml","../xslt/plotcards.xsl", AddPlotcardEventHandlers,reportError); } Here's the modified jquery plugin. I say that its modified because I've added callbacks for success and error handling. /* * jquery.xslt.js * * Copyright (c) 2005-2008 Johann Burkard (<mailto:[email protected]>) * <http://eaio.com> * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN * NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * */ /** * jQuery client-side XSLT plugins. * * @author <a href="mailto:[email protected]">Johann Burkard</a> * @version $Id: jquery.xslt.js,v 1.10 2008/08/29 21:34:24 Johann Exp $ */ (function($) { $.fn.xslt = function() { return this; } var str = /^\s*</; if (document.recalc) { // IE 5+ $.fn.xslt = function(xml, xslt, onSuccess, onError) { try{ var target = $(this); var change = function() { try{ var c = 'complete'; if (xm.readyState == c && xs.readyState == c) { window.setTimeout(function() { target.html(xm.transformNode(xs.XMLDocument)); if (onSuccess) onSuccess(); }, 50); } }catch(exception){ if (onError) onError(exception); } }; var xm = document.createElement('xml'); xm.onreadystatechange = change; xm[str.test(xml) ? "innerHTML" : "src"] = xml; var xs = document.createElement('xml'); xs.onreadystatechange = change; xs[str.test(xslt) ? "innerHTML" : "src"] = xslt; $('body').append(xm).append(xs); return this; }catch(exception){ if (onError) onError(exception); } }; } else if (window.DOMParser != undefined && window.XMLHttpRequest != undefined && window.XSLTProcessor != undefined) { // Mozilla 0.9.4+, Opera 9+ var processor = new XSLTProcessor(); var support = false; if ($.isFunction(processor.transformDocument)) { support = window.XMLSerializer != undefined; } else { support = true; } if (support) { $.fn.xslt = function(xml, xslt, onSuccess, onError) { try{ var target = $(this); var transformed = false; var xm = { readyState: 4 }; var xs = { readyState: 4 }; var change = function() { try{ if (xm.readyState == 4 && xs.readyState == 4 && !transformed) { var processor = new XSLTProcessor(); if ($.isFunction(processor.transformDocument)) { // obsolete Mozilla interface resultDoc = document.implementation.createDocument("", "", null); processor.transformDocument(xm.responseXML, xs.responseXML, resultDoc, null); target.html(new XMLSerializer().serializeToString(resultDoc)); } else { processor.importStylesheet(xs.responseXML); resultDoc = processor.transformToFragment(xm.responseXML, document); target.empty().append(resultDoc); } transformed = true; if (onSuccess) onSuccess(); } }catch(exception){ if (onError) onError(exception); } }; if (str.test(xml)) { xm.responseXML = new DOMParser().parseFromString(xml, "text/xml"); } else { xm = $.ajax({ dataType: "xml", url: xml}); xm.onreadystatechange = change; } if (str.test(xslt)) { xs.responseXML = new DOMParser().parseFromString(xslt, "text/xml"); change(); } else { xs = $.ajax({ dataType: "xml", url: xslt}); xs.onreadystatechange = change; } }catch(exception){ if (onError) onError(exception); }finally{ return this; } }; } } })(jQuery); And, here's my error msg: Object Exception: [unknown name] - Component returned failure code: 0x80600011 [nsIXSLTProcessorObsolete.transformDocument] Here's the info on the browser that I'm using for testing (with firebug v1.5.4 add-on installed): Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 I'm really not sure what to do about this.... any thoughts?

    Read the article

  • XSLT - Catching parameters

    - by Brian Roisentul
    The situation is I have two xslt files: one is called from my ASP.NET code, and there, the second xslt file is imported. What I'd like to accomplish is to pass a parameter to the first one so the second xslt(the one that is imported at the first xslt) can read it. My c# code looks like this: var oArgs = new XsltArgumentList(); oArgs.AddParam("fbLikeFeatureName", "", "Facebook_Like_Button"); ltlContentBody.Text = xmlUtil.TransformXML(oXmlDoc, Server.MapPath(eSpaceId + "/styles/ExploringXSLT/ExploreContentObjects.xslt"), true); And I'm catching the param at the first xslt this way: <xsl:param name="fbLikeFeatureName" /> And then, passing it to the second xslt like this(previously, I import that file): <xsl:call-template name="Articles"> <xsl:with-param name="fbLikeFeatureName"></xsl:with-param> </xsl:call-template> Finally, I'm catching the param on the second xslt file as following: <xsl:value-of select="$fbLikeButtonName"/> What Am I doing wrong? I'm kind of new at xslt.

    Read the article

  • Writing JSON with XSLT

    - by JP
    Hi, I'm trying to write XSLT to transform a specific web page to JSON. The following code demonstrates how Ruby would do this conversion, but the XSLT doesn't generate valid JSON (there's one too many commas inside the array) - anyone know how to write XSLT to generate valid JSON? require 'rubygems' require 'nokogiri' require 'open-uri' doc = Nokogiri::HTML(open('http://bbc.co.uk/radio1/playlist')) xslt = Nokogiri::XSLT(DATA.read) puts out = xslt.transform(doc) # Now follows the XSLT __END__ <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml"> <xsl:output method="text" encoding="UTF-8" media-type="text/plain"/> <xsl:template match="/"> [ <xsl:for-each select="//*[@id='playlist_a']//div[@class='artists_and_songs']//ul[@class='clearme']"> {'artist':'<xsl:value-of select="li[@class='artist']" />','track':'<xsl:value-of select="li[@class='song']" />'}, </xsl:for-each> ] </xsl:template> </xsl:stylesheet>

    Read the article

  • How to execute XSLT 2.0 with ant ?

    - by paulgreg
    I'm trying to run an XSLT transformation from an ant file. I'm using a XSLT 2.0 stylesheet with a saxon 9 parser (supporting XSLT 2.0). The problem is that it seems that ant is always calling an XSLT 1.0 parser. Here's my ant file : <xslt style="stylesheet.xslt" basedir="core/" extension=".xml" destdir="core/" classpath="D:\\DevTools\\saxon\\bin\\saxon9.jar"> </xslt> If I call it directly (without ant), it's working. Any idea ?

    Read the article

  • How to find a word within text using XSLT 2.0 and REGEX (which doesn't have \b word boundary)?

    - by Mads Hansen
    I am attempting to scan a string of words and look for the presence of a particular word(case insensitive) in an XSLT 2.0 stylesheet using REGEX. I have a list of words that I wish to iterate over and determine whether or not they exist within a given string. I want to match on a word anywhere within the given text, but I do not want to match within a word (i.e. A search for foo should not match on "food" and a search for bar should not match on "rebar"). XSLT 2.0 REGEX does not have a word boundary(\b), so I need to replicate it as best I can.

    Read the article

  • Calling a .NET C# class from XSLT

    - by HanSolo
    If you've ever worked with XSLT, you'd know that it's pretty limited when it comes to its programming capabilities. Try writing a for loop in XSLT and you'd know what I mean. XSLT is not designed to be a programming language so you should never put too much programming logic in your XSLT. That code can be a pain to write and maintain and so it should be avoided at all costs. Keep your xslt simple and put any complex logic that your xslt transformation requires in a class. Here is how you can create a helper class and call that from your xslt. For example, this is my helper class:  public class XsltHelper     {         public string GetStringHash(string originalString)         {             return originalString.GetHashCode().ToString();         }     }   And this is my xslt file(notice the namespace declaration that references the helper class): <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:ext="http://MyNamespace">     <xsl:output method="text" indent="yes" omit-xml-declaration="yes"/>     <xsl:template  match="/">The hash code of "<xsl:value-of select="stringList/string1" />" is "<xsl:value-of select="ext:GetStringHash(stringList/string1)" />".     </xsl:template> </xsl:stylesheet>   Here is how you can include the helper class as part of the transformation: string xml = "<stringList><string1>test</string1></stringList>";             XmlDocument xmlDocument = new XmlDocument();             xmlDocument.LoadXml(xml);               XslCompiledTransform xslCompiledTransform = new XslCompiledTransform();             xslCompiledTransform.Load("XSLTFile1.xslt");               XsltArgumentList xsltArgs = new XsltArgumentList();                        xsltArgs.AddExtensionObject("http://MyNamespace", Activator.CreateInstance(typeof(XsltHelper)));               using (FileStream fileStream = new FileStream("TransformResults.txt", FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite))             {                 // transform the xml and output to the output file ...                 xslCompiledTransform.Transform(xmlDocument, xsltArgs, fileStream);                            }

    Read the article

  • Combining XSLT transforms

    - by Flynn1179
    Is there a way to combine two XSLT documents into a single XSLT document that does the same as transforming using the original two in sequence? i.e. Combining XSLTA and XSLTB into XSLTC such that XSLTB( XSLTA( xml )) == XSLTC( xml )? There's three reasons I'd like to be able to do this: Simplifies development; some operations need sequential transforms, and although I can generate a combined one by hand, it's a lot more difficult to maintain that two much simpler, separate transforms. Speed; one transform is in most cases hopefully faster than two. I'm currently working on a program that literally just transforms a data file in XML into an XHTML page capable of editing it using one XSLT, and a second XSLT that transforms the XHTML page back into the data file when it's saved. One test I hope to be able to do is to combine the two, and easily confirm that the 'combined' XSLT should leave the data unchanged.

    Read the article

  • xslt cookbook example not working

    - by Liza dawson
    Hi I am working on this from xslt cookbook type my.xml <?xml version="1.0" encoding="UTF-8"?> <people> <person name="Al Zehtooney" age="33" sex="m" smoker="no"/> <person name="Brad York" age="38" sex="m" smoker="yes"/> <person name="Charles Xavier" age="32" sex="m" smoker="no"/> <person name="David Williams" age="33" sex="m" smoker="no"/> <person name="Edward Ulster" age="33" sex="m" smoker="yes"/> <person name="Frank Townsend" age="35" sex="m" smoker="no"/> <person name="Greg Sutter" age="40" sex="m" smoker="no"/> <person name="Harry Rogers" age="37" sex="m" smoker="no"/> <person name="John Quincy" age="43" sex="m" smoker="yes"/> <person name="Kent Peterson" age="31" sex="m" smoker="no"/> <person name="Larry Newell" age="23" sex="m" smoker="no"/> <person name="Max Milton" age="22" sex="m" smoker="no"/> <person name="Norman Lamagna" age="30" sex="m" smoker="no"/> <person name="Ollie Kensington" age="44" sex="m" smoker="no"/> <person name="John Frank" age="24" sex="m" smoker="no"/> <person name="Mary Williams" age="33" sex="f" smoker="no"/> <person name="Jane Frank" age="38" sex="f" smoker="yes"/> <person name="Jo Peterson" age="32" sex="f" smoker="no"/> <person name="Angie Frost" age="33" sex="f" smoker="no"/> <person name="Betty Bates" age="33" sex="f" smoker="no"/> <person name="Connie Date" age="35" sex="f" smoker="no"/> <person name="Donna Finster" age="20" sex="f" smoker="no"/> <person name="Esther Gates" age="37" sex="f" smoker="no"/> <person name="Fanny Hill" age="33" sex="f" smoker="yes"/> <person name="Geta Iota" age="27" sex="f" smoker="no"/> <person name="Hillary Johnson" age="22" sex="f" smoker="no"/> <person name="Ingrid Kent" age="21" sex="f" smoker="no"/> <person name="Jill Larson" age="20" sex="f" smoker="no"/> <person name="Kim Mulrooney" age="41" sex="f" smoker="no"/> <person name="Lisa Nevins" age="21" sex="f" smoker="no"/> </people> type generic-attr-to-csv.xslt <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:csv="http://www.ora.com/XSLTCookbook/namespaces/csv"> <xsl:param name="delimiter" select=" ',' "/> <xsl:output method="text" /> <xsl:strip-space elements="*"/> <xsl:template match="/"> <xsl:for-each select="$columns"> <xsl:value-of select="@name"/> <xsl:if test="position( ) != last( )"> <xsl:value-of select="$delimiter/> </xsl:if> </xsl:for-each> <xsl:text>&#xa;</xsl:text> <xsl:apply-templates/> </xsl:template> <xsl:template match="/*/*"> <xsl:variable name="row" select="."/> <xsl:for-each select="$columns"> <xsl:apply-templates select="$row/@*[local-name(.)=current( )/@attr]" mode="csv:map-value"/> <xsl:if test="position( ) != last( )"> <xsl:value-of select="$delimiter"/> </xsl:if> </xsl:for-each> <xsl:text>&#xa;</xsl:text> </xsl:template> <xsl:template match="@*" mode="map-value"> <xsl:value-of select="."/> </xsl:template> </xsl:stylesheet> type my.xsl <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:csv="http://www.ora.com/XSLTCookbook/namespaces/csv"> <xsl:import href="generic-attr-to-csv.xslt"/> <!--Defines the mapping from attributes to columns --> <xsl:variable name="columns" select="document('')/*/csv:column"/> <csv:column name="Name" attr="name"/> <csv:column name="Age" attr="age"/> <csv:column name="Gender" attr="sex"/> <csv:column name="Smoker" attr="smoker"/> <!-- Handle custom attribute mappings --> <xsl:template match="@sex" mode="csv:map-value"> <xsl:choose> <xsl:when test=".='m'">male</xsl:when> <xsl:when test=".='f'">female</xsl:when> <xsl:otherwise>error</xsl:otherwise> </xsl:choose> </xsl:template> </xsl:stylesheet> using the apache xalan parser D:\Test>java org.apache.xalan.xslt.Process -in my.xml -xsl my.xsl -out my.csv [Fatal Error] generic-attr-to-csv.xslt:15:6: The value of attribute "select" associated with an element type "xsl:v alue-of" must not contain the '<' character. file:///D:/Test/generic-attr-to-csv.xslt; Line #15; Column #6; org.xml.sax.SAXParseException: The value of attribut e "select" associated with an element type "xsl:value-of" must not contain the '<' character. java.lang.NullPointerException at org.apache.xalan.transformer.TransformerImpl.createSerializationHandler(TransformerImpl.java:1171) at org.apache.xalan.transformer.TransformerImpl.createSerializationHandler(TransformerImpl.java:1060) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1268) at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1251) at org.apache.xalan.xslt.Process.main(Process.java:1048) Exception in thread "main" java.lang.RuntimeException at org.apache.xalan.xslt.Process.doExit(Process.java:1155) at org.apache.xalan.xslt.Process.main(Process.java:1128) Any ideas what am i doing wrong

    Read the article

  • XSLT nowrap and XHTML 1.0 Strict

    - by cc96ai
    we have XSLT to transform XML into HTML in XHTML 1.0 Strict in XSLT <td colspan="3" nowrap="nowrap"> HTML output will be <td colspan="3" nowrap="nowrap"> however it will failure in XHTML 1.0 Strict check. how XSLT can I generate into <td colspan="3" nowrap>

    Read the article

  • How do I ADD an Attribute to the Root Element in XML using XSLT?

    - by kunjaan
    I want to match a root Element “FOO” and perform the transformation (add a version attribute) to it leaving the rest as it is. The Transformation I have so far looks like this: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://schemas.foo.com/fooNameSpace"> <xsl:template match="//FOO"> <xsl:choose> <xsl:when test="@version"> <xsl:apply-templates select="node()|@*" /> </xsl:when> <xsl:otherwise> <FOO> <xsl:attribute name="version">1</xsl:attribute> <xsl:apply-templates select="node()|@*" /> </FOO> </xsl:otherwise> </xsl:choose> </xsl:template> However this does not perform any transformation. It doesn't even detect the element. So I need to do add the namespace in order to make it work: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fd="http://schemas.foo.com/fooNameSpace"> <xsl:template match="//fd:FOO"> … But this attaches a namespace attribute to the FOO element as well as other elements: <FOO xmlns:fd="http://schemas.foo.com/fooNameSpace" version="1" id="fooid"> <BAR xmlns="http://schemas.foo.com/fooNameSpace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> Is there a way to say that the element is using the default namespace? Can we match and add elements in the default name space? Here is the original XML: <?xml version="1.0" encoding="UTF-8"?> <FOO xmlns="http://schemas.foo.com/fooNameSpace" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <BAR> <Attribute name="HEIGHT">2067</Attribute> </BAR> </FOO>

    Read the article

  • Reference XSLT-file using a project relative way (instead of an absolute path)

    - by Binary255
    The file at xsltFileName is in my project WebSite2 (at the root-level of the project). I currently use an absolute path to get the XSLT file name: XslCompiledTransform xslt = new XslCompiledTransform(); String xsltFileName = "file:///C:\\Documents and Settings\\kentl\\My Documents\\Visual Studio 2005\\WebSites\\WebSite2\\page.xsl"; xslt.Load(xsltFileName); I would like to have a solution without an absolute path. What would be the cleanest way?

    Read the article

  • Generating PDF document using XSLT

    - by Nair
    I have one huge XML document. I have set of XSL representing each node in the XML. These XSL also have java script to generate the dynamic content. It uses images which are in seperate images folder and it uses fonts as well. At present, I have a program which displays all the nodes that can be transformed and user click on one of the node and the program performs XSLT and display the content in HTML format on IE screen. I want to write a program (.Net , C# or any .Net language) which will allow user to do XSLT tranform on all the available notes and create one PDF document. My initial requirement was to display all the document in the IE itself, so I reused the existing code, and foreach node, perform XSLT and then append it to the current HTML with a page break and it worked ok till we hit huge files. So the requirement changed to create one PDF file with all the nodes. I have couple of questions, 1. What is the best way to create PDF file using XSLT transformation? 2. Since the images are relative path, if we generate the XSLT in html and then write it to a output stream will it loose the images? 3. Will the font be preserved in the PDF document? Really appriciate if someone could point me to some good example that I can take and run with it. Thanks a lot.

    Read the article

  • XSLT 2.0 Header Leaks into Transformed XML

    - by user1303797
    First, a thank you in advance. Second, this is my first post so apologies for any errors or wrongdoings. I am a noob w/ xml and xslt, and can't seem to figure this out. When I transform some xml using xslt 2.0, some of the headers from the xslt leaks into the new xml. It doesn't seem to do it in xslt 1.0 (granted the xslt is a little different). Here is the xml: <?xml version="1.0" encoding="ISO-8859-1" ?> <xml_content> <feed_name>feed</feed_name> <feed_info> <entry_1> <id>1</id> <pub_date>1320814800</pub_date> </entry_1> </feed_info> </xml_content> Here is the xslt: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/TR/xhtml1/strict"> <xsl:output method="xml" indent="yes" /> <xsl:template match="xml_content"> <Records> <xsl:for-each select="feed_info/entry_1"> <Record> <ID><xsl:value-of select="id" /></ID> <PublicationDate><xsl:value-of select='xs:dateTime("1970-01-01T00:00:00") + xs:integer(pub_date) * xs:dayTimeDuration("PT1S")'/></PublicationDate> </Record> </xsl:for-each> </Records> </xsl:template> </xsl:stylesheet> Here is the new xml. Look specifically at the first "Records" element. <?xml version="1.0" encoding="UTF-8"?> <Records xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/TR/xhtml1/strict"> <Record> <ID>1</ID> <PublicationDate>2011-11-09T05:00:00</PublicationDate> </Record> </Records>

    Read the article

  • XSLT, process elements one by one

    - by qui
    Hi I am quite weak at XSLT so this might seem obvious. Here is some sample XML <term> <name>cholecystocolonic fistula</name> <definition>blah blah</definition> <reference>cholecystocolostomy</reference> </term> And here is the XSLT I wrote a while ago to process it <xsl:template name="term"> { "dictitle": "<xsl:value-of select="name" disable-output-escaping="yes" />", "html": "<xsl:value-of select="definition" disable-output-escaping="yes"/>", "referece": "<xsl:value-of select="reference" disable-output-escaping="yes"/> } </xsl:template> Basically I am creating JSON from the XML. The requirements have now changed so that now the XML can have more than one definition tag and reference tag. They can appear in any order, i.e definition, reference, reference, definition, reference. How can I update the XSLT to accommodate this? Probably worth mentioning that because my XSLT processor is using .NET I can only use XSLT 1.0 commands. Many thanks!

    Read the article

  • XSLT Transformation of XML File

    - by Russ Clark
    I've written a simple XML Document that I am trying to transform with an XSLT file, but I get no results when I run the code. Here is my XML document: <?xml version="1.0" encoding="utf-8" ?> <Employee xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="XSLT_MVC.Controllers"> <ID>42</ID> <Name>Russ</Name> </Employee> And here is the XSLT file: <?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:ex="XSLT_MVC.Controllers" > <xsl:output method="xml" indent="yes"/> <xsl:template match="/"> <xsl:copy> <!--<xsl:apply-templates select="@* | node()"/>--> <xsl:value-of select="ex:Employee/Name"/> </xsl:copy> </xsl:template> </xsl:stylesheet> Here is the code (from a C# console app) I am trying to run to perform the transform: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Xml; using System.Xml.Xsl; using System.Xml.XPath; namespace XSLT { class Program { static void Main(string[] args) { Transform(); } public static void Transform() { XPathDocument myXPathDoc = new XPathDocument(@"docs\sampledoc.xml"); XslTransform myXslTrans = new XslTransform(); myXslTrans.Load(@"docs\new.xslt"); XmlTextWriter myWriter = new XmlTextWriter( "results.html", null); myXslTrans.Transform(myXPathDoc, null, myWriter); myWriter.Close(); } } } When I run the code I get a blank html file. I think I may have problems with the namespaces, but am not sure. Can anyone help with this?

    Read the article

  • Trying to use an Xslt for an xml in asp.net

    - by Josemalive
    Hello, i have the following xslt sheet: <?xml version="1.0" encoding="UTF-8" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:variable name="nhits" select="Answer[@nhits]"></xsl:variable> <xsl:output method="html" indent="yes"/> <xsl:template match="/"> <div> <xsl:call-template name="resultsnumbertemplate"/> </div> </xsl:template> <xsl:template name="resultsnumbertemplate"> <xsl:value-of select="$nhits"/> matches found </xsl:template> </xsl:stylesheet> And this is the xml that im trying to mix with the previous xslt: <Answer xmlns="exa:com.exalead.search.v10" context="n%3Dsl-ocu%26q%3Dlavadoras" last="9" estimated="false" nmatches="219" nslices="0" nhits="219" start="0"> <time> <Time interrupted="false" overall="32348" parse="0" spell="0" exec="1241" synthesis="15302" cats="14061" kwds="14061"> <sliceTimes>15272 </sliceTimes> </Time> </time> </Answer> Im using a xslcompiledtransform and that's working fine: XslCompiledTransform transformer = new XslCompiledTransform(); transformer.Load(HttpContext.Current.Server.MapPath("xslt\\" + requestvariables["xslsheet"].ToString())); transformer.Transform(xmlreader, null, writer); My problems comes when im trying to put into a variable the "nhits" attribute value placed on the Answer element, but i'm not rendering anything using my xslt sheet. Do you know what could be the cause? Could be the xmlns attribute in my xml file? Thanks in advance. Best Regards. Jose

    Read the article

  • XSLT, worth investing time in, any actual alternatives?

    - by Keeno
    I realise this has been a few other questions on this topic, and people are saying use your language of choice to manipulate the xml etc etc however, not quite fit my question exactly. Firstly, the scope of the project: We want to develop platform independant e-learning, currently, its a bunch of HTML pages but as they grow and develop they become hard to maintain. The idea: Generate up an XML file + Schema, then produce some XSLT files that process the XML into the eLearning modiles. XML to HTML via XSLT. Why: We would like the flexibily to be able to easy reformat the content (i realise CSS is a viable alternative here) If we decide to alter the pages layout or functionality in anyway, im guessing altering the "shared" XSLT files would be easier than updating the HTML files. So far, we have about 30 modules, with up to 10-30 pages each Depending on some "parameters" we could output drastically different page layouts/structures, above and beyond what CSS can do Now, all this has to be platform independant, and to be able to run "offline" i.e. without a server powering the HTML Negatives ive read so far for XSLT: Overheard? Not exactly sure why...is it the compute power need to convert to HTML? Difficult to learn Better alternatives Now, what I would like to know exactly is: are there actually any viable alternatives for this "offline"? Am I going about it in the correct manner, do you guys have any advice or alternatives. Thanks!

    Read the article

  • Copy subset of xml input using xslt

    - by mdfaraz
    I need an XSLT file to transform input xml to another with a subset of nodes in the input xml. For ex, if input has 10 nodes, I need to create output with about 5 nodes Input <Department diffgr:id="Department1" msdata:rowOrder="0"> <Department>10</Department> <DepartmentDescription>BABY PRODUCTS</DepartmentDescription> <DepartmentSeq>7</DepartmentSeq> <InsertDateTime>2011-09-29T13:19:28.817-05:00</InsertDateTime> </Department> Output: <Department diffgr:id="Department1" msdata:rowOrder="0"> <Department>10</Department> <DepartmentDescription>BABY PRODUCTS</DepartmentDescription> </Department> I found one way to suppress nodes that we dont need XSLT: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output omit-xml-declaration="yes"/> <xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*"/> </xsl:copy> </xsl:template> <xsl:template match="Department/DepartmentSeq"/> <xsl:template match="Department/InsertDateTime"/> </xsl:stylesheet> I need an xslt that helps me select the nodes I need and not "copy all and filter out what I dont need", since i may have to change my xslt whenever input schema adds more nodes.

    Read the article

  • Cocoon lite / XML and XSLT publishing framework

    - by bambax
    What publishing frameworks (publishing only, NOT full-blown CMS) based on XML, XSLT sitemaps and pipelines exist, are stable, active, and simpler / lighter than Cocoon? I have glanced at: mod_xslt (http://www.mod-xslt2.com/) which seemed to be exactly that, but looks all but dead, and required a complex setup, and apparently supported only libxslt as an XSLT processor (I'd like to be able to use Saxon and XSLT 2.0 of course). Apache Forrest (http://forrest.apache.org/), but I don't understand if it is really simpler than Cocoon or is rather an additionnal thing on top of Cocoon? What I'm looking for is something that does just this: recieves an HTTP GET "runs it" through a sitemap finds a pipeline: source.xml - xslt1.xsl - xslt2.xsl - xsltn.xsl - serialize runs the pipeline serves the serialized result to the client and: uses Saxon (or is "processor independant") can be installed "lightly", that is: should not require much more configuration than the sitemap Maybe I'm describing an early version of Cocoon, or a future version of an XProc implementation... Anyway, does such a tool exist?

    Read the article

  • XML + Xslt -> Xml with PHP

    - by rokdd
    Hi, I know that there are really a mass of XML XSLT php merging threads at SO. But php specific i could not found what might my problem: $xml = new DOMDocument; $xml-load("f.xml"); $xsl = new DOMDocument; $xsl-load('test.xsl'); // init and configure processor $proc = new XSLTProcessor; $proc-importStyleSheet($xsl); // import xsl document $xml2=$proc-transformToXML($xml); echo $xml2; My xslt file looks a bit empty.. However i tried ´output method="xml"´. but it doesnot help.. PHP returns always the data as text or html but not in XML.. what i am doing wrong. I only want to edit the XML with xslt and save back to XML (file). THanks for your help!

    Read the article

  • XSLT transformations in Ruby and JRuby

    - by jpatokal
    Simple question: are there any solid XSLT libraries that work in both Ruby and JRuby? REXML works in both, but does not have XSLT support. ruby-xslt doesn't work in JRuby. The latest Nokogiri betas do support JRuby, but the support is still buggy and throws occasional NullPointerExceptions for XML input that works fine in Ruby. (In particular, any transforms that don't result in valid XML cause it to barf, even if xsl:output is set to 'text'!) JXslt is just a wrapper for Java's Xalan/Saxon and doesn't work in Ruby. Please tell me I'm missing something?

    Read the article

  • using document() function in .NET XSLT generates error

    - by Simon
    I'd like to use embedded resources in my XSLT file, but while invoking 'document(...)' C# complains that "Error during loading document ..." I'd like to use defined resources in XSLT file and get them by this: "document('')//my:resources/"... How can i do that?? ex xsl: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:my="xslt-gruper-v1.2.xsl" exclude-result-prefixes="my"> <my:resources> <one>tryb</one> </my:resources> <xsl:variable name="res" select="document('')/*/my:resources/("/> </xsl:stylesheet> How can i get access to such structure without exceptions in C#? I'll add that during static transform via ex. Opera everything works fine.

    Read the article

  • Why can XSLT not parse this XML?

    - by Matt W
    Taking the XSLT and XML from this page as an example: http://www.w3schools.com/xsl/xsl_transformation.asp I have an xml file which contains (above example modified): <?xml version="1.0" encoding="ISO-8859-1"?> <?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?> <catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/"> <cd> In my case, the output contains nothing when the XSLT/XML is processed by the browser. The moment I remove the attributes from the element, it works. Problem is, I don't really have the option of pre-processing those attributes out of the file. Can anyone explain how to force the XSLT to work with the XML as is, please? After all, those attributes seem fairly standard. Many thanks, Matt.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >