RE: [xsl] checking sequence inside processing-instruction

Subject: RE: [xsl] checking sequence inside processing-instruction
From: "Houghton,Andrew" <houghtoa@xxxxxxxx>
Date: Mon, 11 Aug 2008 09:06:24 -0400
> From: Ganesh Babu N [mailto:nbabuganesh@xxxxxxxxx]
> Sent: Monday, August 11, 2008 8:17 AM
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re: [xsl] checking sequence inside processing-instruction
>
> I am testing the saxon:get-pseudo-attribute() function in my xslt 1.0
> style sheet to generate the HTML view.
>
> My processing-instruction as follows:
>
> <?PAGEBREAK id="PAGE0001" number="i"?>
>
> this XSL is not generating any info related to number information.
> even i tried with the @id then it is displaying the following message:
>
> Warning: on line 162 of file:/D:/ganesh-schemas/xml/gae.xsl:
>   The attribute axis starting at a processing-instruction node will
> never select
>  anything

Here is an example you can adapt:

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="/theme/searchRetrieveResponse.xsl"  ?>
<document/>

<?xml version="1.0"?>
<xsl:transform version="1.0"
  exclude-result-prefixes="saxon xsd xsi xsl"
  xmlns:saxon="http://saxon.sf.net/";
  xmlns:xsd="http://www.w3.org/2001/XMLSchema";
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>
  <xsl:output method="xml" version="1.0"
    media-type="text/xml" encoding="utf-8"
    omit-xml-declaration="no" indent="yes"
  />
  <xsl:template match="/">
    <document>
      <name><xsl:value-of
select="name(/processing-instruction()[1])"/></name>
      <value><xsl:value-of select="/processing-instruction()[1]"/></value>
      <name>@type</name>
      <value>
        <xsl:for-each select="/processing-instruction()[1]">
          <xsl:value-of select="saxon:get-pseudo-attribute('type')"/>
        </xsl:for-each>
      </value>
    </document>
  </xsl:template>
</xsl:transform>

I wish Saxon had an extension function saxon:get-pseudo-attributes($pi as
processing-instruction) ==> xs:string* which returned the name/value pairs.


Andy.

Current Thread