[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] A regular expression for the content of any processing-instruction


Subject: Re: [xsl] A regular expression for the content of any processing-instruction
From: Hermann Stamm-Wilbrandt <STAMMW@xxxxxxxxxx>
Date: Mon, 27 Feb 2012 16:26:42 +0100

Just a sample, only a string, and how to access the different parts:

$ xsltproc pi.xsl empty.xml
<?whateverYouWantPI justString?>
justString
whateverYouWantPI

$ cat pi.xsl
<?whateverYouWantPI justString?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>
  <xsl:output omit-xml-declaration="yes"/>

  <xsl:template match="/">
    <xsl:variable name="pi" select="document('')/processing-instruction
()"/>
    <xsl:copy-of select="$pi"/>
    <xsl:text>&#10;</xsl:text>
    <xsl:value-of select="$pi"/>
    <xsl:text>&#10;</xsl:text>
    <xsl:value-of select="name($pi)"/>
    <xsl:text>&#10;</xsl:text>
  </xsl:template>

</xsl:stylesheet>
$


Mit besten Gruessen / Best wishes,

Hermann Stamm-Wilbrandt
Level 3 support for XML Compiler team and Fixpack team lead
WebSphere DataPower SOA Appliances
https://www.ibm.com/developerworks/mydeveloperworks/blogs/HermannSW/
----------------------------------------------------------------------
IBM Deutschland Research & Development GmbH
Vorsitzende des Aufsichtsrats: Martina Koederitz
Geschaeftsfuehrung: Dirk Wittkopp
Sitz der Gesellschaft: Boeblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


|------------>
| From:      |
|------------>
  >---------------------------------------------------------------------------------------------------------------------------------------------|
  |Wendell Piez <wapiez@xxxxxxxxxxxxxxxx>                                                                                                       |
  >---------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  >---------------------------------------------------------------------------------------------------------------------------------------------|
  |xsl-list@xxxxxxxxxxxxxxxxxxxxxx,                                                                                                             |
  >---------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  >---------------------------------------------------------------------------------------------------------------------------------------------|
  |02/23/2012 08:04 PM                                                                                                                          |
  >---------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  >---------------------------------------------------------------------------------------------------------------------------------------------|
  |Re: [xsl] A regular expression for the content of any processing-instruction                                                                 |
  >---------------------------------------------------------------------------------------------------------------------------------------------|





Hi,

On 2/23/2012 9:04 AM, Costello, Roger L. wrote:
> Is it common practice to structure the content of PIs as
> attribute/value pairs?
>
> For example:
>
> <?realaudio version="5.0" frequency="5.5kHz" bitrate="16Kbps"?>

It is not uncommon, but that doesn't make it good. (Or bad.)

> Is it reasonable to issue a policy to a community that the content of
> all PIs must be structured as attribute/value pairs?

In general, I don't know how anyone would benefit from such a policy.
The whole point of PIs is that they address out of band processes, whose
interfaces are arbitrary and unspecified by definition. So this isn't
really much different from saying no PIs at all, since you can't know
ahead of time which ones you're excluding.

Is that reasonable in your particular case? I suppose anything is possible.

Cheers,
Wendell

--
======================================================================
Wendell Piez                            mailto:wapiez@xxxxxxxxxxxxxxxx
Mulberry Technologies, Inc.                http://www.mulberrytech.com
17 West Jefferson Street                    Direct Phone: 301/315-9635
Suite 207                                          Phone: 301/315-9631
Rockville, MD  20850                                 Fax: 301/315-8285
----------------------------------------------------------------------
   Mulberry Technologies: A Consultancy Specializing in SGML and XML
======================================================================


Current Thread
Keywords
xml