S
stryder100
Hi. I'm processing a stylesheet with saxonb9-1-0-5j and am trying to
output a processing instruction that has an exact copy of some markup
in it. I'm running into the same problem whether I use the java
version of SAXON on UNIX or the Windows/.Net version.
Here's what I'm trying.
<xsl:for-each select="//footnote">
<xslrocessing-instruction name="footnote"><xsl:value-
of select="."/></xslrocessing-instruction>
</xsl:for-each>
This doesn't give me what I want because I guess it applies the
"default" template and just outputs the text as the body of the PI.
However if I try to output parsed data as the body of the processing
instruction using the saxon parse function like this...
<xsl:for-each select="//footnote">
<xslrocessing-instruction name="footnote"><xsl:value-
of select="saxonarse(.)"/></xslrocessing-instruction>
</xsl:for-each>
or even...
<xsl:for-each select="//footnote">
<xslrocessing-instruction name="footnote"
select="saxonarse(.)"/>
</xsl:for-each>
I get a runtime error "SXXP0003: Error reported by XML parser: Content
is not allowed in prolog.". As I understand it the "prolog" is what
occurs outside of the document element of an XML document, like a DTD
declaration or an <?xml ... ?> declaration. But I'm trying to output
this processing instruction inside the document element. It even
gives me this error message when I just try and output this PI in
place, right where the footnote is...
<xsl:template match="footnote">
<xslrocessing-instruction name="footnote"><xsl:value-of
select="saxonarse(.)"/></xslrocessing-instruction>
</xsl:template>
This gives me the "Content not allowed in prolog" error also, even
though the <footnote> is inside the document element.
According to http://www.w3.org/TR/REC-xml/#NT-Char there are no real
limitations on what can be included as the body of a PI, certainly no
exceptions that could possibly exist in a footnote's content.
I've tried numerous other combinations using <xsl:copy>, <xsl:copy-
of>, <xsl:variable>, <xsl:apply-templates>, all sorts of trickery to
try and accomplish this to no avail.
I'm able to output markup in a processing instruction if I define it
literally, as in...
<xslrocessing-instruction name="footnote">"<tag>here's some
arbitrary data</tag>"</xslrocessing-instruction>
which outputs
<?footnote "<tag>here's some arbitrary data</tag>"?>
This suggests that technically I CAN put markup in the data in a
processing instruction, I just can't put in parsed data from the
document. Or something.
If anyone knows a way to do it I'd be most appreciative.
Thanks.
output a processing instruction that has an exact copy of some markup
in it. I'm running into the same problem whether I use the java
version of SAXON on UNIX or the Windows/.Net version.
Here's what I'm trying.
<xsl:for-each select="//footnote">
<xslrocessing-instruction name="footnote"><xsl:value-
of select="."/></xslrocessing-instruction>
</xsl:for-each>
This doesn't give me what I want because I guess it applies the
"default" template and just outputs the text as the body of the PI.
However if I try to output parsed data as the body of the processing
instruction using the saxon parse function like this...
<xsl:for-each select="//footnote">
<xslrocessing-instruction name="footnote"><xsl:value-
of select="saxonarse(.)"/></xslrocessing-instruction>
</xsl:for-each>
or even...
<xsl:for-each select="//footnote">
<xslrocessing-instruction name="footnote"
select="saxonarse(.)"/>
</xsl:for-each>
I get a runtime error "SXXP0003: Error reported by XML parser: Content
is not allowed in prolog.". As I understand it the "prolog" is what
occurs outside of the document element of an XML document, like a DTD
declaration or an <?xml ... ?> declaration. But I'm trying to output
this processing instruction inside the document element. It even
gives me this error message when I just try and output this PI in
place, right where the footnote is...
<xsl:template match="footnote">
<xslrocessing-instruction name="footnote"><xsl:value-of
select="saxonarse(.)"/></xslrocessing-instruction>
</xsl:template>
This gives me the "Content not allowed in prolog" error also, even
though the <footnote> is inside the document element.
According to http://www.w3.org/TR/REC-xml/#NT-Char there are no real
limitations on what can be included as the body of a PI, certainly no
exceptions that could possibly exist in a footnote's content.
I've tried numerous other combinations using <xsl:copy>, <xsl:copy-
of>, <xsl:variable>, <xsl:apply-templates>, all sorts of trickery to
try and accomplish this to no avail.
I'm able to output markup in a processing instruction if I define it
literally, as in...
<xslrocessing-instruction name="footnote">"<tag>here's some
arbitrary data</tag>"</xslrocessing-instruction>
which outputs
<?footnote "<tag>here's some arbitrary data</tag>"?>
This suggests that technically I CAN put markup in the data in a
processing instruction, I just can't put in parsed data from the
document. Or something.
If anyone knows a way to do it I'd be most appreciative.
Thanks.