I have a little problem with validating xml, xslt in details. I have an xslt stylesheet th开发者_如何学JAVAat transforms xml data source to xsl:fo document. Something like this:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<xsl:template match="/">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns="http://www.w3.org/1999/xhtml">
<fo:layout-master-set>
<fo:simple-page-master margin-top="25mm" margin-bottom="25mm" margin-left="25mm" margin-right="25mm" page-width="210mm" page-height="297mm" master-name="simplePageLayout">
<fo:region-body region-name="xsl-region-body" column-gap="0.25in" />
<fo:region-before region-name="xsl-region-before" display-align="after" extent="0.1mm" padding-top="0pt" padding-left="0.4in" padding-right="0.4in" padding-bottom="0pt" />
<fo:region-after region-name="xsl-region-after" display-align="before" extent="0.4in" padding-top="4pt" padding-left="0.4in" padding-right="0.4in" padding-bottom="0pt" />
</fo:simple-page-master>
<fo:page-sequence-master master-name="default-sequence">
<fo:repeatable-page-master-reference master-reference="simplePageLayout" />
</fo:page-sequence-master>
</fo:layout-master-set>
<fo:page-sequence master-reference="default-sequence">
<fo:flow flow-name="xsl-region-body">
<fo:block font-family="Segoe UI" color="#000000" font-size="9pt" />
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>
What I want to do is to validate written xsl:fo elements, ignoring xsl tags. Is it possible? For now I use dtd validation (I have xsd schema too) for validating Fo, but it gives me an error on each xsl tag.
Summary: Is it possible to validate only fo elements against the schema, ignoring xsl tags, and how should I do it? Maybe a code snippet in C#, or a hint how to modify documents?
What you want to do the schema validation against is the output after you do the transform, not against the XSLT document. When you run the XSLT transformation against the input XML, the resulting output shouldn't contain any of the XSL tags.
精彩评论