Meaningless Drivel is fun!*
The moose likes XML and Related Technologies and the fly likes xpath and processing instructions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xpath and processing instructions " Watch "xpath and processing instructions " New topic
Author

xpath and processing instructions

Daniel Salzer
Greenhorn

Joined: Dec 19, 2003
Posts: 8
Hi XSLT/XPATH gurus,
I am converting an xml file into html. However, I want to list only the objects below that have the processing instructions "<?INSERT OBJECT?>" and filter out all the others. I know how to do that based on attributes or child element but not based on processing instructions.
Anybody ?
<OBJECT NAME="CONTACTS"> <?INSERT OBJECT?>
<OBJ_ATTR NAME="ID">
<OBJ_ATTR NAME="NAME">
</OBJECT>
<OBJECT NAME="COMPANY>
<OBJ_ATTR NAME="ID">
<OBJ_ATTR NAME="NAME">
<OBJ_ATTR ADDRESS1="1100 Vernon Street">
</OBJECT>
So how do I formulate the "template select" for this ?

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl utput method="html"/>
<xsl:template match="/">
<html>
<head>
<title>New Objects</title>
</head>
<body>
<h1>New Objects</h1>
<ul>
<xsl:apply-templates select = "???"/>
</ul>
</body>


Daniel
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
May sound like a stupid question from me, but "What is the real use of having a XML structure like this ?"


Spritle Software Blogs
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
this link will help you write XSLT for accessingPI, but as you can see, you need to change your xml structure a bit to achieve your task.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: xpath and processing instructions
 
Similar Threads
XSLT: set attribute for all ancestors based on child
Extracting XSL content to XML with XSLT problem ...
XSLT stylesheet looping through the same node (recursion?)
Why aren't DENSITY & DISTANCE text displayed?
Simple XML/XSL Does not Work??