w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Get Data From XML using XSLT
With this input XML: <filters> <TT TXT1="Electronics" /> <TT TXT1="Computer" /> <TT TXT1="HP" /> </filters> the following XSL stylesheet: <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="filters"> <xsl:call-template name="print"> <xsl:with-param name="items" select="TT"/> </xsl:call-template> </xsl:template> <!-- This template uses recursion on the list of TT elements to print them one-by-one, treating the last one differently. --> <xsl:template name="print"> <xsl:param name="items"/> <xsl:choose> <!-- Check t

Categories : Xml

Mapping XML data with XSLT
You have the my prefix mapped to two different namespace URIs. In the XML document it's http://schemas.microsoft.com/office/infopath/2003/myXSD/2013-04-09T08:39:48 and in the XSLT it's http://schemas.microsoft.com/office/infopath/2003/myXSD/2012-12-05T14:55:38 Thus your match and select expressions match nothing because they're looking for elements in the wrong namespace.

Categories : Xml

XSLT gathering data
You need to structure your code according to the structure of the output, not the structure of the input. Don't try to do things as you encounter information in the input; do them when you need to generate the relevant piece of the output. There are cases when this can seem inefficient because it means visiting the same input more than once. Usually these inefficiences will prove apparent rather than real. But the first thing is to get the transformation working; if it's not fast enough you can come back to us with another question.

Categories : Java

XSLT Data Merge
It's a standard grouping problem. In XSLT 2.0: <xsl:template match="Root"> <xsl:for-each-group select="DataPage/Record" group-by="DEBITNO"> <DataPage> <Record> <xsl:copy-of select="TEMP, DEBITNO, DOSSIERNUMMERINT"/> <xsl:for-each select="current-group()"> <Line> <xsl:copy-of select="ID, YEAR, DATE, DESC, AMOUNT"/> </ </ </ </ </ </

Categories : Xml

in xslt 2.0, can I import a common xslt file into two files where one outputs xml and the other output html?
As Ken Holman says, the answer is yes, you can do exactly what you are suggesting. @Nalaka526 if your read the question then you will see that it only demands a "yes" or "no" answer. The only reason my answer is longer is that SO doesn't allow short answers.

Categories : Xslt

xslt 1.0 - get data to flow into 2 columns down then over
Simplifying the issue, I would start off by counting the number of rows you require for the table (I am assuming you want a table per section element here) <xsl:variable name="rows" select="ceiling(count(entry) div $columns)" /> (Note $columns is a variable that will hold '2' in this instance, but can be changed to any number of columns you want) This would allow you to select the correct number of entry elements for the start of each row <xsl:for-each select="entry[position() &lt;= $rows]"> Then it is a case of outputing a table cell for the first element, and then other entry elements in the row. To get the other elements, you would do this: <xsl:variable name="otherEntries" select="following-sibling::entry[position() mod $rows = 0]" /> The only slight iss

Categories : Xslt

XSLT sort output csv data
Looks like the sorting should be done by ItemInfo/ItemDetails/ItemDetailInfo/id therefor you need to iterate over ItemDetailInfo. Try this slightly change version of your xslt. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <xsl:output method="text" encoding="UTF-8" indent="yes"/> <xsl:param name="delim" select="';'"/> <xsl:param name="break" select="'&#xA;'"/> <xsl:template match="/"> <xsl:for-each select="/Root/ItemInfo/ItemDetails/ItemDetailInfo"> <xsl:sort select="id" data-type="text" order="ascending"/> <xsl:call-template name="copmitemtemp"> <xsl:with-param name="item" select=

Categories : Sorting

XSLT issue with reading in non-xml data
Well if you want to pull in a text file then with XSLT 2.0 and later you can do that but not by simply using a URL, you need to call the unparsed-text function e.g. <xsl:variable name="inputData" as="xs:string" select="unparsed-text('http://example.com/foo')"/> See http://www.w3.org/TR/xslt20/#unparsed-text, depending on the encoding of your text document you need to add a second parameter when calling the function.

Categories : Xslt

Processing hl7 type message using xslt or regex, or combination of two (XSLT 1.0)
Your source message is in a string form, you need to create a parser that uses regex to split the message based on first pipes and then carat. refer to Unable to parse ^ character which has my original code for the parser and the solution gives a different approach to it. After you have individual elements you need to add it to your xml as nodes.

Categories : Regex

xslt: preserve space that exist in xslt without adding xsl:text
You can use xml:space="preserve" on any containing element (xsl:template here) although then you'd also get the newlines and spaces from the start and end of the template.

Categories : Xslt

Store output of a XSLT node into XSLT variable
I think you simply want <xsl:variable name="test"> <xsl:text>"</xsl:text> <xsl:choose> <xsl:when test="/root/node1">B</xsl:when> <xsl:when test="/root/node2">S</xsl:when> <xsl:otherwise>NA</xsl:otherwise> </xsl:choose> <xsl:text>"</xsl:text> </xsl:variable> and then <Test2> <xsl:text>"</xsl:text> <xsl:value-of select="$test"/> <xsl:text>"</xsl:text> </Test2> You could use an element node as the wrapper but it does not improve things if you simply want to deal with some strings like B or NA.

Categories : Xslt

Sorting XML data based on date value using XSLT 1.0
Change <xsl:for-each select="INSTestElement"> <xsl:variable name="created"><xsl:value-of select="Created"/></xsl:variable> <xsl:variable name="created_date" select="substring-before($created, ' ')"/> <xsl:variable name="year" select="substring($created_date, string-length($created_date) -3)"/> <xsl:variable name="day" select="substring-before($created_date, '/')"/> <xsl:variable name="month" select="format-number(substring-before(substring-after($created_date, $day), $year), '00')"/> <xsl:copy> <xsl:apply-templates> <xsl:sort select="$year" data-type="number"/> <xsl:sort select="$month"

Categories : Sorting

XSLT split sorted data into different tables
The standard approach to this kind of problem in XSLT 1.0 is called Muenchian grouping. You define a key that groups your target elements in the way you want <xsl:key name="bsById" match="b" use="@id" /> then use a trick with generate-id to extract just the first node in each group as a proxy for the group as a whole <xsl:apply-templates select="b[generate-id() = generate-id(key('bsById', @id)[1])]" mode="group"> <xsl:sort select="@id" /> </xsl:apply-templates> So now the following template would fire once per group, and you can use the key function within it to get all the nodes in the group <xsl:template match="b" mode="group"> <table> <!-- extract all the nodes that are grouped with

Categories : Sorting

XSLT - Extract and manipulate portion of XML data
It would be nice if your input data had the <br/> elements as actual elements, instead of being escaped, so that they could be selected directly using XPath. But since they are as they are, you can use regexp replace, relying on the assumption that they will always conform to a limited range of patterns. You will often be warned not to parse XML or HTML in general using regexps, and rightly so, because regexps aren't a general solution. But for limited uses they can be sufficient. If I've guessed your requirements correctly, you could use something like <xsl:value-of select="replace(Description, '&lt;[Bb][Rr] ?/?>', '&#10;&#10;&#10;')"/> That will give you the sample output you showed, as opposed to adding a cou

Categories : Xslt

How to Optimize XSLT for Referencing data in other XMLs
Consider to use <xsl:key name="UniqueID" match="z:row" use="@ID"/> then <xsl:for-each select="z:row/@ID[generate-id() = generate-id(key('UniqueID',.))]"> <xsl:variable name="FRId"> <xsl:value-of select="current()"/> </xsl:variable> <xsl:variable name="curNSet" select="//z:row[@ID=$FRId]"/> can be replaced with <xsl:for-each select="z:row[generate-id() = generate-id(key('UniqueID', @ID))]"> <xsl:variable name="FRId" select="@ID"/> <xsl:variable name="curNSet" select="key('UniqueID', @ID"/> I am not sure you need the variable FRId at all but defining it with a select attribute instead of a nested value-of is certainly consuming less resources. To make <xsl:apply-templates

Categories : Xslt

Sorting data from lists and grouping in a table with XSLT
I won't answer your whole question. It is a bit too much for StackOverflow. What I will do is answer a core part of your question (first column). This should be enough to extrapolate from to get a full answer. If you are having problems extrapolating from my answer, then subdivide the unresolved parts of your problem into smaller tasks and post a separate SO question on each, of course, after you have had a good attempt at it yourself. This input document ... (slightly different than yours to correct formation errors and not dealing with the case of the last li) <DIV> <ul> <li>fr0.1.1 : en1.1.1</li> <li>fr0.2.1 : en1.2.1</li> <li>fr0.4.1 : en1.3.1</li> <li>fr0.6.1 : en1.4.1</li> <li>fr0.5.1 : en1.5.1&

Categories : Xml

jQgrid: Data Not loaded
The JavaScript code which you use is correct and it corresponds to JSON data which returned from the server. The demo demonstrate that the code should work. In the demo I made only minor changes (added height: "auto", gridview: true option and increased width of description column to see the results in the pager more clear. I removed mtype:'POST' only because my demo loads the data directly from the file per HTTP GET). I recommend you to compare your demo with my. Additionally I recommend you to use loadError callback (see the answer) which can help to diagnose errors during loading the grid. I hope that the error description will help you to find the error in your code. Typical error could be wrong Content-Type of HTTP response. Additional small optimization which I suggest you is the fo

Categories : Jquery

XSLT: How to extract xml content from xslt variable
Because this is nested XML in a CDATA section, the XML parser treats it as a single text node (the CDATA effectively says "ignore anything in here that looks like markup, treat it as text."). So you need to extract the text as a string and then pass it to another parser to turn it into a tree of nodes. There's no standard way of doing that until XSLT/XPath 3.0, but some processors have extensions. With Saxon-PE or higher you can use the XPath 3.0 function parse-xml().

Categories : Xml

XSLT loop inside XSLT variable
Yes, you can capture the result of any processing in a variable in this way. However, in XSLT 1.0 there are restrictions on how you can use the resulting variable: it's known as a result tree fragment. If you want to process it in any interesting ways, you will need the exslt:node-set() extension to convert it to a regular document tree. In XSLT 2.0 this restriction is removed.

Categories : Xml

java web app and xslt - what happens when xml/xslt files get changed?
If you make a change to the XSLT, it depends on three factors: Cache-control XSLT Processor Spring Interface If the cache has not expired, nothing is recompiled and nothing changes. If the cache has expired, then the Spring view resolver triggers the XSLT processor to reparse the XML data source when the page reloads If the Spring Interface is not using precompiled stylesheets, then the stylesheet is recompiled

Categories : Java

The xslt sorting doesnt work in xslt
Assuming the "artikel" should be ordered by preis put the xsl:sort as first statement into your xsl:for: Something like: <xsl:for-each select="//lieferungen/artikel"> <xsl:sort select="preis" order="ascending"/> <tr> </tr> </xsl:for-each> What you tried: <td><xsl:apply-templates><xsl:sort select="preis" order="ascending"/></xsl:apply-templates></td> does not work because the current node is already "artikel". The xsl:apply-templates is done for all children (and attributes) of "artikel".

Categories : Xml

ParaView: Must Data Be Loaded Into One Node?
Generally speaking, yes. ParaView can be run in parallel (http://www.paraview.org/Wiki/Users_Guide_Client-Server_Visualization) to distribute the data across nodes. What kind of file format this is? Based on the file-format, the reader could either read in partitioned data on processes or will read on single node and then one will have to redistribute using filters.

Categories : Misc

Get the data that is being loaded by jquery in PHP CodeIgniter
I didn't thoroughly look at your code, but I noticed when you print your table rows in a loop you have the id="try" assigned to all of the rows. the html id-attribute is a unique identifier so the JS that is alerting the value will only return the value of the first id it will find (at least that's what i think). Try to use a class instread of an id and then use this in your js. $(document).on('click','.try',function(){ alert($(this).val()); return false; });

Categories : PHP

Specify id label for data loaded from array
yes, there is an option called id Function used to get the id from the choice object or a string representing the key under which the id is stored. $("#myselect").select2({ id: 'ID', data: { results: dummy, text: "Name" }, formatSelection: function (item) { return item.Name; }, formatResult: function (item) { return item.Name } });

Categories : Javascript

Why isn't all the data getting loaded into my MySQL table?
The lines that weren't loaded probably contained the " character. If you specify that your fields are terminated with ", the quotes inside of them should be escaped like this - "" (double quotes). The OPTIONALLY keyword before ENCLOSED may help.

Categories : Mysql

How much data is loaded onto the client after a Meteor.subscribe?
Everything that is defined in your Meteor.publish will be sent down to the client: e.g if you have Meteor.publish("rooms", function() { return Rooms.find(); }); The entire result of the query Rooms.find() is sent down to the client. The .fetch() only fetches all the data from the cursor which helps stop looping through all of the unnecessary data (in memory). The cursor's fetch/forEach won't influence the subscription and data availed from the server. To control what comes down to the client you need to explicitly tell the subscription/publish what to publish to the client. A good example on how to do this is the Chat & Rooms example at the meteor docs under subscribe

Categories : Javascript

Get session data in AJAX loaded page
put this at the top of nav.php if (!isset($_SESSION)) {session_start();} the problem occurs when you load the page at the beginning. you start the session and you include the nav.php where you start the session once again. if you load the page for the second time the page is independent of the parent and the session can be started again.

Categories : PHP

How to make the TableView scrollable with already loaded data in iOS
It sounds like you are loading the data from a web service synchronously, so the UI thread will be blocked until it is done, and you will not be able to scroll the table view. Use NSOperationQueue and NSOperation, GCD, NSURLConnection and a delegate, or a library like AFNetworking to load data asynchronously. As for the disclosure button, see the docs for UITableViewDelegate. Specifically, you are interested in -tableView:accessoryButtonTappedForRowWithIndexPath:.

Categories : IOS

Getting the JSON data but it's not getting loaded into the view in Ember.js
Ember data requires the json response to be in a certain format. The base key needs to be the name of the model. In your case there is no base key. Example: You're returning the following [{"id":"1", "last_name":"Solow", "first_name":"Jeanne", "suffix":null, "expiration":"2013-11-15", "email":"jeanne_s@earth.com", "street":"16 Ludden Dr."}, {etc}] but ember needs something like this: {'users': [{"id":"1", "last_name":"Solow", "first_name":"Jeanne", "suffix":null, "expiration":"2013-11-15", "email":"jeanne_s@earth.com", "street":"16 Ludden Dr."}, {etc}]} Either you need to change the json response from the server, or make use of another library for the interface with the server.

Categories : Codeigniter

Filtering eager-loaded data in Laravel 4
To filter, you can use where() as in the fluent DB queries: $data = Club::with(array('activities' => function($query) { $query->where('activity_start', '>', DB::raw('current_time')); }))->activityType()->get(); The example which served as inspiration for this is in the laravel docs, check the end of this section: http://laravel.com/docs/eloquent#eager-loading (the code's not tested, and I've taken some liberties with the property names! :) )

Categories : Laravel

Possible to retrieve only a portion of xml data loaded with ajax?
You can use the slice function to reduce the set of matched elements to a subset specified by a range of indices. Then apply a function to each element as usual: $(xml).find('person').slice(0,9).each(function () ... )

Categories : Jquery

how to use fancybox with dynamically loaded data via ajax
If I understand correctly, this line: <a href="sample.php" class="fancy" >sample</a> does not exist when the page is loaded. But it is loaded via another ajax call later. If that is the case, your javascript code will not attach to the element. The code $(document).ready(function() { only runs once the DOM loads. You need to either call the fancybox function in a callback of the ajax function (see Complete in the jQuery ajax docs), ... Or do something like what this blog post does: Adding Fancybox to Dynamically Loaded Content

Categories : Ajax

Pandas read_csv and DataFrame - How to use the data once loaded
Try print(this_file[:10]) to see the first 10 rows. DataFrame is column based, that is, each column is a stand-alone series: race['race_date'][0] # take element 0 of race_date column See http://pandas.pydata.org/pandas-docs/stable/indexing.html for more details.

Categories : Python

How to access data in partialview loaded using Ajax
If I understand you correctly you can do what you want y having two submit buttons on the same form, each calling a separate action method. That way each submit button will have access to all the fields in the form. For a detailed explanation of how you can do that see my answer here: How to use ajax link instead of submit button for form? Edit In response to comment: the action method LoadData should return a partial view that contains the other two controls and have the whole begin form included in it: @using (Ajax.BeginForm("LoadData", new AjaxOptions{ UpdateTargetID = "Div1", InsertionMode = InsertionMode.Replace })) { <select id

Categories : Asp Net Mvc

The data isn't being loaded into datagrid view. What am i missing?
It looks like you may have forgotten to call SqlConnection.Open() to actually open the connection. I would also recommend wrapping your connection in a using and explicitly calling SqlConnection.Close() at the end of it, so you don't accidentally leave it open: using(SqlConnection conn = Database.GetConnection()) { conn.Open(); /* rest of code here */ conn.Close(); } For some other good information/examples of properly opening/disposing of SqlConnections, you can also take a look at these SO questions: Close and Dispose - which to call? Do I have to Close() a SQLConnection before it gets disposed? in a "using" block is a SqlConnection closed on return or exception?

Categories : SQL

Collecting data from a view while it's loaded on the page
You are correct, MVC is stateless. You could approach this from an AJAX angle: Create an action that will set a "ToBeDeleted" field related to an Image to be true. As you mentioned, you could then have a service delete all these images later. Use an AJAX call on the delete button to give the ID of the image to this controller. On success, hide the image/div. Only display Images that aren't waiting to be deleted on the page refresh.

Categories : C#

Send an ajax request only when data has to be loaded for the first time
Create the tab panels once and hide or show them when clicked using panel.setVisible( false ); Your function that creates a tab when you click a node may create a tab only once and then mark it as created by pushing it to an tab array panels. So when you click a node, the function will hide all panels in panels using panel.setVisible( false ); and create the panel if not yet created, and if created only show it via panel.setVisible( true );

Categories : Ajax

syntax of accessing json data loaded with $.getJSON
$.getJSON returns a jQuery asynchronous request object and not the result of the ajax call. If you want data acquired from ajax, you need to use it in the callback. $.getJSON("samplejson.js").done(function (json) { $("#header2").html(json); });

Categories : Json

How do I parse HTML data loaded via an Ajax response?
Mechanize will not execute javascript so you need to use a different approach. One way is to use a so-called headless browser, for example Watir in combination with the headless gem or PhantomJS with Poltergeist for Ruby bindings.

Categories : Ruby

How to save the data to database through dynamically loaded controls
in the database vision you need a table with at least 3 columns, first a VARBINARY column that is called BLOB column to store your file, second a VARCHAR column to store your file extension (e.g .gif, .jpeg) , third a VARCHAR or NVARCHAR column to store your caption. but the point is in your application you need to convert your file into array of bytes then pass it to sql server as varbinary parameter. private Byte[] getDocumentFormatter(string path) { FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read); BinaryReader br = new BinaryReader(fs); Byte[] bytes = br.ReadBytes((Int32)fs.Length); br.Close(); fs.Close(); return bytes; } but in web environment you can replace path with your

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.