[xsl] Using PIs to set attributes

Subject: [xsl] Using PIs to set attributes
From: "Steven Anderson" <sanderson@xxxxxxxxxxxxxx>
Date: Wed, 7 Jun 2006 23:31:17 -0700
I've got some XML that looks like this:

<p>Programmatic access to objects is determined by the objects
that are
  <ul><?Fm Condstart API_Only?>
    <li>defined in your enterprise WSDL file</li>
    <li><?Fm Condend API_Only?><?Fm Condstart OT_Only?>
          available in the EntityNames[] array in the Session3 object
          <?Fm Condend OT_Only?></li>
    <li>in your organization configuration</li>
    <li>valid with your security access  ....

The processing instructions are designed to indicate conditional text
(if API is the target, include the content between the <?Fm Condstart
API_Only?> and  <?Fm Condend API_Only?>).

I'd like to process this XML and be able to replace it with something
like this:

<p>Programmatic access to objects is determined by the objects
that are
  <ul>
    <li platform="api">defined in your enterprise WSDL file</li>
    <li><ph platform="ot">available in the EntityNames[] array
           in the Session3 object</ph></li>
    <li>in your organization configuration</li>
    <li>valid with your security access  ....

I'm really not sure how to do this.  These PIs are ill-behaved, crossing
element boundaries, can be nested, and can cross each other's boundaries
as well.  In other words, you could also see this:

<p>Programmatic access to objects is determined by the objects
that are
  <ul><?Fm Condstart API_Only?>
    <li>defined in your enterprise WSDL file</li>
    <li><?Fm Condstart OT_Only?><?Fm Condend API_Only?>
          available in the EntityNames[] array in the Session3 object
          <?Fm Condend OT_Only?></li>
    <li>in your organization configuration</li>
    <li>valid with your security access  ....

Notice how OT_Only starts before API_Only ends?  I'm stumped, so any
advice would be greatly appreciated.

      Steve

Current Thread