XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Matt AdamsSubject: Searching simplest XPATH matching node outputter
Author: Matt Adams
Date: 18 Sep 2004 03:10 PM
I am searching for a xslt stylesheet which simply outputs (at the console
or into a file) all matching nodes (including their individual attributes)
for a given XPath expression and a given (valid) xml document.

How does such a XSLT stylesheet look like?

Matt

Posttop
Minollo I.Subject: Searching simplest XPATH matching node outputter
Author: Minollo I.
Date: 18 Sep 2004 03:32 PM
Something like this?
(it assumes you are running it against books.xml, which is part of the example documents bundled with Stylus Studio)

<?xml version='1.0' encoding='utf-8'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="/">
<result-set>
<xsl:apply-templates select="//book[@bookid>4]"/>
</result-set>
</xsl:template>

<xsl:template match="*">
<xsl:copy-of select="."/>
</xsl:template>

</xsl:stylesheet>

Instead of the hardcoded XPath expression you could use a global parameter that you can set from a command line; and you can of course customize the way the node is rendered in <xsl:template match="*"> (maybe including only the name and the attributes, but not the children element...).

Hope this helps,
Minollo

 
Topic Page 1 2 3 4 5 6 7 8 9 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.