Positions in Relation to Parent Nodes

Positions are relative to the parent. Consider the following data, which has line numbers on the left for explanation only.

1 	<x>
               
2 		<z>
               
3 		<z/>
               
4 	</x>
               
5 	<x>
               
6 		<y>
               
7 		<y/>
               
8	</x>
               
9	<x>
               
10		<y>
               
11		<y/>
               
12	</x>
               

            

The following query returns the first y element contained in each x element. It returns the elements on lines 6 and 10. The XPath processor finds all x elements. For each x element, the XPath processor then returns the first y element it finds.

x/y[1] 
               

            

The next query returns the first y element that is contained in an x element that is in the context node set. It returns the element on line 6. The XPath processor finds all y elements inside x elements. The XPath processor then returns the first element in that set.

(x/y)[1] 
               

            

The next query returns the empty set. The XPath processor finds the first x element. It then searches that first x element for the first y. Because the first x element does not contain a y element, this query returns the empty set.

x[1]/y[1] 
               

            

Varying Record Layout to XML

Not every row in a text file has to have the same layout. Convert to XML has advanced pattern-recognition tools to route the data to where it belongs.

JavaServer Pages IDE (JSP IDE)

The Stylus Studio JSP IDE provides syntax help and code completion for developing JSP 1.2 and JSP 2.0 applications.

EDI to XML Mapping in Stylus Studio

Learn how to use Stylus Studio's EDI to XML mapping tools in Convert-to-XML, including loading an EDI file, inspecting application control codes, customizing XML output and other advanced EDI to XML mapping features.

Translating EDIFACT Documents to XML

The EDIFACT to XML Converter is a primary component of the adapter library. The XML that is generated is well commented and indented, and can be used anywhere XML is normally used — with XML Schemas, XQuery, XSLT, and so on.

Stylus Most Wanted

 
Free Stylus Studio XML Training:
W3C Member