开发者

XSLT: running a stylesheet w/o having <xi:include> resolve themelves

I'm trying to add a processing instruction after each <xi:include> element.

<xsl:template match="@*|node()" name="identity">
    <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
</xsl:template>
<xsl:template match="xi:include">
    <xsl:call-template name="identi开发者_Python百科ty"/>
    <xsl:processing-instruction name="hard-pagebreak"/>
</xsl:template>

The problem is that as soon as I apply this to my contents.xml file (which is a listing of a whole bunch of <xi:include>, the tags gets resolved and the file is essentially flattened (i.e. the <xi:include> are replaced with what they represent. This seems to happen whenever I run any stylesheet on contents.xml

Is there a way to run a stylesheet without having the <xi:include> become resolved? Maybe turning off a xslt parser or something for the duration of that stylesheet???


Either use an XML parser that doesn't understand xi:include or set the right switch for prevent the xi:include processing by the parser.

If these are not possible, then you must include your processing in the same transformation that generates the xi:include elements.


You just need to use an XSLT processor that doesn't understand the <xi:include> tags. What are you using to run the XSLT at the moment?

I'm pretty sure that the Microsoft XSLT processor would not process these:

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=2fb55371-c94e-4373-b0e9-db4816552e41&displaylang=en

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜