Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

xpath and processing instructions

 
Daniel Salzer
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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>
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May sound like a stupid question from me, but "What is the real use of having a XML structure like this ?"
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic