XPath & XQuery Tutorial for SQL Pros (Video)


Prior to starting at Altova I had zero experience with both XPath and XQuery. The first task I was presented with was to train myself on both query languages as quickly as possible and produce a concise video that would serve as an XPath tutorial and XQuery tutorial. It was important to develop a thorough understanding of their features and capabilities because both languages are integral to app development in MobileTogether and querying data in XMLSpy. I started with a strong background in SQL, learning XPath and XQuery by building queries first in SQL, and then determining how to replicate them in both query languages.

Read more…

Tags: , , , , ,

Data Mapping with XSLT3 Math Functions


XSLT3 adds trigonometry and other advanced math functions, new formatting functions, functions to collect environment variables, and more, extending XSLT and XSLT2 XML transformation standards. Data analysts and other data professionals can apply XSLT3 functions to solve XML data mapping and integration challenges that require complex mathematical computations. Let’s look at some MapForce examples of data mapping with XSLT3 math functions using trigonometry and other complex math expressions.

Read more…
Tags: , , ,

Build Advanced XML Reports with New XPath Debugger


Altova StyleVision is a unique, easy-to-use tool for creating business reports using a drag-and-drop visual design interface. StyleVision lets you build reports for XML as well as database and XBRL sources. Each design you create can be automated for recurring reporting to HTML, PDF and Word, either using the auto-generated XSLT stylesheet or via StyleVision Server.

Integral to XSLT stylesheet design is XPath for selecting and calculating data, as well as defining styling rules, in your report. New features added to StyleVision include an XPath debugger that makes testing and perfecting your report easier than ever. Let’s see how it works.

Developer working from home
Read more…
Tags: , , , , , , ,

3 Ways XML Text View Just Got Better


Though XMLSpy includes a helpful Grid View for visual editing, Text View remains the most popular pane for developers using the XML editor. Intelligent XML editing functionality helps make the job easier, and we’re continuously adding functionality to the XMLSpy Text View to facilitate this.

Let’s look at some new functionality XML developers will have at their disposal starting with Release 3 of XMLSpy 2017.

XML developer

Read more…

Tags: , , ,

How to Debug XPath and XQuery Expressions


XPath and XQuery are powerful functional programming languages for selecting and querying data in desktop or mobile applications – and, in fact, XQuery was added to the TIOBE Index in early 2016.

When you’re writing XPath and XQuery statements, it’s vital to ensure your expressions return the desired results, and this can be a frustrating process of trial and error. The XPath / XQuery Debugger in XMLSpy makes it easy to test and troubleshoot your code, in the very same window where you’re developing your expressions.

XPath/XQuery Debugger

Read more…

Tags: , , , ,

Is it just a wrapper around HTML5 and JavaScript?


When we demonstrate MobileTogether at tradeshows, we often get asked this question: “So is it just a native app wrapper around HTML5 and JavaScript?” The simple answer is: “No.”

MobileTogether is a complete mobile app development framework that is based on our very own rendering and processing engine, which gives us a lot more flexibility and power to provide a true native app experience on each mobile operating system platform and also make important mobile platform functions that are not commonly accessible from JavaScript or HTML5-based web apps available to the developer.

Table user question

Read more…

Tags: , , ,

XPath Editor and Tester (Video)


Writing XPath expressions is an important skill for any developer – whether they are for an XSLT stylesheet, complex XQuery instruction, or even selecting data in a mobile application. And while XPath syntax is simple by nature, it’s also powerful, and writing and debugging the most efficient expression to select exactly the data you need can be a challenge.

This quick video demonstrates some of the tools in the XMLSpy XPath editor that make developing and testing XPath, as well as XQuery, easier. By using a point and click interface for interactive, incremental expression building, you’ll get what you need faster and with less frustration.

To learn more about XPath, check out these free resources:

Tags: ,

Learn XPath 3.1 with Altova Online Training


We’ve recently updated our free, online XPath Training course to include information on what’s new in XPath 3.1, which is the latest version of the XML Path Language.

XPath 3.1 adds vital new functionality, including support for arrays and maps, functions for processing JSON data, and a collection of new operators and functions.

XPath Training

The XPath Training course covers these in detail, explaining each new function and operator and illustrating its use with helpful examples.  The course also provides sample XML files that you can download for hands-on practice as you progress through the chapters.

Access the free XPath 3.0 and 3.1 Training now!

Or check out our other free online course offerings, including XMLSpy Training, XML Schema 1.1 Training, and more.

Tags: ,

New Online Training for XPath 3.0


We are happy to introduce our latest online training course offering a comprehensive look at XPath 3.0. This course is available free-of-charge, in a self-paced and straightforward format. With interactive examples it’s easy to learn new material, and you can even download sample files to experiment writing your own XPath expressions as you go. It is perfect for those who are new to XPath or experienced users looking to learn about the added features in Version 3.0.

XPath training

Let’s take a look at what you’ll learn in the free XPath Training course.  

Read more…

Tags: , , ,

Innovative New XPath/XQuery Tools


Support for XPath and XQuery in XMLSpy got a major boost with Release 3 of Version 2015. In addition to adding support for the latest standards versions – XPath 3.1 and XQuery 3.1 – we’ve added innovative new tools for developing and testing XPath and XQuery expressions in the XPath/XQuery window.

These new tools make it much faster to develop, evaluate, and refine expressions and statements before adding them to larger XSLT or XQuery documents. This will save you time and frustration – because you can understand how each operator or function works and ensure that your expressions return the desired results immediately. I found the function descriptions and entry helpers especially helpful for learning how the new maps and arrays features in XPath/XQuery 3.1 are implemented.

XPath and XQuery Tools

Read more…

Tags: , ,

New Support for XPath/XQuery 3.1, WS-Security, and More Debut in R3


Release 3 of the Version 2015 Altova MissionKit desktop developer tools and Altova server software products is now available with updated standards support, customer requested features, and innovative new functionality that will save you time on everything from XPath and XQuery development, to advanced data mapping, to XBRL report rendering and beyond. You can skip right to the good stuff and upgrade now, or click Read More below for all the details.
clip_image005

Read more…

Tags: , , , , , , , , , , ,

A Cross-Platform Simulator for Enterprise Mobile App Development


In the past it was difficult and time consuming to synchronize development of cross-platform mobile enterprise applications because each mobile operating system required a different tool set or unique steps to build a compiled result.

Altova MobileTogether simplifies and accelerates cross-platform mobile development with the MobileTogether Designer. Using MobileTogether, developers create a single Solution file for Android, iOS, Windows Phone 8, Windows 8, and in HTML-5 browsers on other platforms.

Even better, the MobileTogether Designer includes a Simulator window that lets developers instantly execute the Solution to test logic, view the design as it will appear on a variety of devices, and examine changes in workflow data during execution.

Here is a view of the BizBudget example Solution as seen in the Simulator representations for iOS and Android devices:

MobileTogether Simulator showing iOS and Android devices

Both views were generated from the same solution file, simply by changing the simulation preview device.
Read more…

Tags: , , , , ,

XPath Expressions for Data Reporting


In our earlier post titled Use XPath Expressions to Refine Data Selection, we described how to use XMLSpy to develop an XPath expression to select one table of data contained in a much larger data set provided by the US Department of Education.

An HTML report based on XPath data selection in StyleVision

We can reuse the work in XMLSpy to quickly create a StyleVision design for a report or an e-Form to communicate highlights from the data.
Read more…

Tags: , , , , ,

Use XPath Expressions to Refine Data Selection


In this era of big data we often need to simplify analysis and communication by creating customized views into sections of a larger file. XPath, short for XML Path Language, is designed to allow users to address parts of large XML documents. XMLSpy supports XPath with an XPath Analyzer window and in its interface for charting XML data, MapForce supports XPath functions for XML data mapping, and StyleVision supports XPath in conditional templates, extension templates, and template filtering.

faces-laptop

Read more…

Tags: , , , , ,

Using Table Row and Column Conditions in StyleVision 2013


The ability to conditionally hide table rows or columns has been a popular feature request from StyleVision users. StyleVision 2013 adds the capability in the form of conditional expressions on table rows and columns. Conditional processing can be set on individual columns and rows of static and dynamic tables, as well as on column and row headers, to display or hide the column, row, or header depending on the truth of the condition. The conditions are specified using StyleVision’s XPath Expression editor. If a condition evaluates to true, the column, row, or header is displayed; otherwise it is not (i.e., is hidden).

StyleVision 2013 Edit XPath Expression dialog

Let’s take a look at some scenarios for which this new feature is exceptionally useful.

Read more…

Tags: , ,

XPath Enhances XML Reports


In our previous post on Creating Elegant Reports for GPS XML Data we used an XPath expression to select nodes from an XML document for an elevation line chart. You can also use XPath to compute values. Altova StyleVision includes strong support for XPath, and we can write XPath expressions to add interesting information to our GPS XML reports. For instance, we can process the elevation data stored by the GPS device in meters to plot a chart showing the elevation in feet above sea level instead.

Altova StyleVision line chart

Read more…

Tags: , , ,

New! XSLT Technology Training


We’re excited to introduce our new XSLT Technology training as the latest Altova Online Training offering. As with all our trainings, XSLT Technology is released as a free, self-paced course, available online, so students can fit it into their busy schedules.

XSLT transforms XML data into other formats, and this course will transform a beginner XML student into an advanced user. Intermediate and advanced students will gain valuable techniques to add to their XML toolkits.

clip_image002

Read more…

Tags: , , , , , , , , ,

Processing the Groupon API – Part 3


Concluding the series in this post, we will apply a stylesheet to transform the XML data created from our mapping of the Groupon API into HTML. Here is an example of the XML output from the data mapping we created last time: XML produced by MapForce from the Groupon API

Assign a Stylesheet to Transform XML The Component Settings dialog for the output component of the MapForce mapping allows us to assign a stylesheet created with Altova StyleVision.

Assigning a StyleVision Stylesheet to a MapForce component
Assigning a stylesheet to the data mapping output component integrates the operations of MapForce and StyleVision, and a new series of buttons appears at the bottom of the MapForce mapping window for HTML, RTF, PDF, and Microsoft Word formats. (You must have both MapForce and StyleVision installed on your computer.) MapForce ouput formats available through a stylesheet When you click any of these output format buttons, MapForce executes the data mapping exactly as we saw in the previous post. MapForce seamlessly passes the XML output to StyleVision, where it is transformed to the selected format. MapForce then displays the formatted document in the Output window. Here is the MapForce Output window for HTML, based on the StyleVision Power Stylesheet assigned above: HTML output produced by MapForce from the Groupon API The MapForce Output menu lets you save the XML data mapping output or the HTML document formatted according to the stylesheet. How to Make a Stylesheet We designed a stylesheet for the Groupon API data mapping using Altova StyleVision, based on the XML Schema for the MapForce output component. The intuitive StyleVision interface and powerful data access and manipulation features make it easy to create attractive documents in HTML, RTF, PDF, and Microsoft Word formats from XML files. The screenshot below shows the StyleVision Design View of the Extreme Groupon stylesheet. The blue numbered circles identify the location of each design feature listed following the image. StyleVision stylesheet for the MapForce Groupon API mapping Features of the SPS file

  1. User-defined html specifies the viewport meta tag for mobile devices. This lets us design one stylesheet to generate a single HTML file for computers and mobile devices
  2. Document title with customized font, size, and color
  3. An autocalc element uses the XPath count function to count the number of deals in the XML input document and inserts the total
  4. The date timestamp is placed at the top of the document even though the date element occurs at the end of the XML input data file
  5. Images from the Altova and Groupon Web sites are referenced by hyperlinks, not as inline image data
  6. Horizontal rules set off each individual deal. For HTML documents, the rules automatically fit the browser window width
  7. Customized fonts and sizes assigned to different elements
  8. A two-column table organizes each deal description
  9. URLs in the XML file are dynamically assigned as hyperlinks for embedded images, fixed text, and dynamic data

StyleVision Power Stylesheets can combine multiple .xsd files, existing .css stylesheets, database schemas, XBRL taxonomies, and more to produce richly formatted reports that can even include automatically generated charts in various styles. You can also use StyleVision to define e-forms with data entry fields, drop down menus, radio buttons and other advanced features. Previewing Stylesheet Transformations StyleVision lets you assign a working XML file to preview your output as you design the stylesheet, and the buttons along the bottom of the Design window make it convenient to display the formatted working file as you refine your design. We saved the XML output of the MapForce mapping and assigned it as our working document. When the stylesheet was complete, the HTML Preview in StyleVision was identical to the MapForce HTML Output window shown above. To view the document on a mobile device you can either deploy the HTML as a page on a Web site or email it as an attachment. HTML version of the MapForce mapped data on a mobile device In addition to the stylesheet itself and formatted versions of the working document, StyleVision lets you save generated XSLT files to transform other XML files using your stylesheet design outside the StyleVision application. Automation Next Time In the future when you want to re-run a data mapping and refresh the HTML document with up to date data, there are two ways to automate the process:

  • You can run MapForce from a command line with parameters to name the mapping definition file and even call StyleVision to create formatted output
  • You can generate royalty-free code for the mapping in XSLT, Java, C++, or C# to combine with the XSLT code from StyleVision to build your own end-to-end application

XMLSpy, MapForce, and StyleVision are all available together in the specially priced Altova MissionKit. See for yourself how easy it is to use the MissionKit to convert data from a Web API — download a free 30-day trial!
Editor’s Note: Our original series on mapping data from the Groupon API ran in three parts you can see by clicking the links here: Part 1 of Processing the Groupon API with Altova MapForce describes how to create dynamic input by collecting data from multiple URLs. Processing the Groupon API with MapForce – Part 2 describes how we filtered data from the API and defined the output to extract only the most interesting details. Processing the Groupon API – Part 3 describes formatting the output as a single HTML document optimized for desktop and mobile devices, and reviews ways to automate repeat execution.

Tags: , , , , , , , ,

Use Built-In XPath Functions


In developing one of the Altova Online Training courses, I sorted a list of books by the authors. I realized that my author field was a string of the author’s full name, so the books were sorted by the first letter of the string, or the author’s first name. It did not fit into the course to fix the sorting, but you can easily extract the last name from a string and use it for the sorting key using XPath functions. If you then use the books’ titles for a secondary sort key, you run into an issue with titles that start with “A”, “An”, or “The”. I want to use the title for the secondary sort key, but ignore a leading definite or indefinite article.Output the book list with a  sort corrected using XPath expressions Let’s take a look at how we created this XSLT code.

This article was written using XMLSpy as the platform, but the same XPath expressions can be used inside MapForce or StyleVision to achieve similar results. We can start with a simple XML book list. We have 4 books with author and title nodes. List of three books An XSLT to create a list of the books would look like this: Output the book list without a sort This will generate the following output: Unsorted Book List The books are output in the order they appear in the original data file. If we add xsl:sort to the xsl:for-each loop, we can arrange our output in other ways. Output the book list with a basic sort This will generate a sorted list, but not sorted properly. Output from XSL with Basic Sort Sorting author as a string, results in “Jules Verne” appearing ahead of “Mark Twain”. Also, “A Connecticut Yankee in King Arthur’s Court” appears ahead of “Adventures of Huckleberry Finn”. We want to ignore the indefinite article, “A”, so that “Adventures of Huckleberry Finn” appears ahead of “A Connecticut Yankee in King Arthur’s Court”. We can use XPath expressions to extract the sorting keys we want. Output the book list with a  sort corrected using XPath expressions Let’s examine the code before we look at the output. We replace “author” with “reverse(tokenize(author, ‘ ‘))[1]”. Tokenize breaks the author string into tokens using a single white space as the break point. So, “Jules Verne” is tokenized into “Jules” and “Verne”. Reverse reverses the order of the tokens to “Verne” and “Jules”. The one in square brackets chooses the first item in the list, “Verne”. This is the value that is used in for the xsl:sort function to arrange the books. This is not the perfect solution, but it works in our case. The title looks convoluted, but the logic is straightforward. The “tokenize(title,’ ‘)[1]” expression extracts the first word of the title. So, the first if test is “Is the first word of the title the word “A”? “. If it is, then we return the substring of the title that starts with its third letter, thus eliminating “A” and the space. If the first word of the title is not “A”, then we need to test it again to see if the first word of the title is “The”. If it is, we use the substring of the title starting with its fifth character, thus eliminating “The” and a space. If we fail both tests, then we just pass the title along as the sorting key. We could add another test to our code to see if the first word is “An”, but it is not needed for this data set. Executing this last XSLT, we get the following output. Output from XSL with Corrected Sort “Mark Twain” is now ahead of “Jules Verne”. “Adventures of Huckleberry Finn” appears ahead of “The Celebrated Jumping Frog of Calaveras County” and “A Connecticut Yankee in King Arthur’s Court”. The flaw in our approach to the author string is that we want “Jules Verne” to be treated as “Verne, Jules” for the sort, so that if we had a book by “Jimmy Verne”, the sort would treat them as different authors. Our code does not. Using “concat(reverse(tokenize(author, ‘ ‘))[1], reverse(tokenize(author, ‘ ‘))[2])” would sort “Jules Verne” and “Jimmy Verne” correctly, but this solution only will work with 2 word names. If an author had a suffix (“Martin Luther King, Jr.”) or multiple words (“George Herbert Walker Bush”), the code would fail. There are many exceptions to the general rules on alphabetizing names, and the code to allow for all variants goes far beyond the scope of this article. What we wanted to show was the ability to manipulate XML data on the fly using XPath expressions. We do not always have complete control on the format of our data sources, but using the power of XPath expressions, we can transform the data into the format that we need. A copy of the files used in these examples is available here.

Tags: , , , , , , , ,

Exploring Large XML/XBRL Documents with XMLSpy


Last week, while giving a demo of the new XBRL capabilities in the Altova MissionKit, we stumbled across an interesting question: What is the best way for a semi-technical SME (in this case a CPA) to navigate a large XML/XBRL document for data entry? XMLSpy, which is included in the MissionKit tool suite, has a lot of cool features and different views for XML data, including the ever-popular grid view for visualizing the hierarchical structure of an instance document in a graphical manner. The ability to easily expand and collapse containers and drag and drop to change position makes XMLSpy’s grid view a pretty good choice for the task.  XMLSpy grid view Of course let’s not forget that the XMLSpy XML editor also has a Find feature that would enable users to simply press Ctrl F or use the Find in Files window to find any element that they are looking for… but alas, in the case of XBRL, where element names are mindbogglingly verbose, this may be a challenge. Consider, for example, the US-GAAP’s aptly named <us-gaap:IncomeLossFromContinuingOperationsBeforeIncomeTaxesMinorityInterestAnd IncomeLossFromEquityMethodInvestments>. Not so much fun to type into a Find dialog… Our solution, therefore, and the winner for the easiest and most comprehensive way for even a non-technical user to find XML elements in a large document, utilizes a combination of longstanding XMLSpy features (the XPath Analyzer window) and a new feature in XMLSpy v2009, XPath auto-completion. Simply begin typing the element name in the XPath Analyzer window, and XMLSpy will show you all of the possibilities. Next, choose the one you are looking for, and XMLSpy will navigate directly to that node in the XML document.   xpath auto-completion in XMLSpy   Now that was easy! And better yet, you get to tell your friends that you know XPath. 😉 Of course, for developers, intelligent XPath auto-completion provides a lot more than the ability to find a node quickly. As you type, it provides you with valid XPath functions, as well as element and attribute names from the associated schema and XML instance(s). XMLSpy accounts for namespaces when listing options and even provides deep path suggestions when the required node is not in close proximity to the current context. XMLSpy is available standalone or as part of the award-winning MissionKit tool suite.

Tags: , , ,

New tables and XPath filtering for flexible stylesheet design


To an Altova MissionKit user, it probably comes as no surprise that the majority of the new features in our latest (v2009) release were based on customer requests – yeah, that’s how we roll. But we also had the opportunity to build a lot of new functionality into the MissionKit tools, specifically XMLSpy, MapForce, and StyleVision,  because of our added support for XBRL. As you may already know, XBRL is built on top of XML, and adds semantic definitions to financial reporting data. XBRL Dimensions 2.1 also has some interesting rendering and presentation requirements that, in our humble opinion, have given StyleVision some of its coolest new features to date: an all-new table design and XPath filtering. The new table design in StyleVision makes the visual stylesheet design interface only that much more intuitive. Now, you can design your table rows and columns and then simply drag borders to resize. You can also right-click to rearrange the table structure with copy and paste – or just delete the entire row/column right there. The new table design also lets you have static and dynamic properties within the same table design. tables   XPath filtering is also an enormously important new feature in StyleVision – especially for those of us who like to create reusable design templates. This feature lets you filter data out of your rendering based on an XPath expression. Simply right-click the node that you want to filter, and StyleVision’s XPath Builder will open and provide intelligent auto-completion to help you formulate a valid XPath statement. It even interprets your location in the stylesheet design so that your expression is not only valid according to the XPath standard, but it also makes sense in the context of your template design. xpath Of course, if you need to make all of your filtered data available again, all you need to do is delete the XPath filter icon in your design. StyleVision 2009 delivers all this and single source output in HTML, RTF, PDF, and Word 2007 from XML, databases, and now XBRL – and you can even design your own e-Forms for editing in Altova Authentic. Check out a free trial, and please let us know what you think!