Validating multiple XML files
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 32
- Joined: Wed Jan 25, 2006 5:43 pm
Validating multiple XML files
Hi,
is there a way of validating multiple XML files in a single step (and I don't mean open them in Oxygen)? I thought it could work with an XSLT-file. If I would define an XML with a list of file names and apply an XSLT to this file that uses the document() function, I thought the files get automatically validated when being opend by document(), but that seems not to be true. So, is there another way to achieve this goal or do I have to get a command line tool for the job?
Cheers
- Alex
is there a way of validating multiple XML files in a single step (and I don't mean open them in Oxygen)? I thought it could work with an XSLT-file. If I would define an XML with a list of file names and apply an XSLT to this file that uses the document() function, I thought the files get automatically validated when being opend by document(), but that seems not to be true. So, is there another way to achieve this goal or do I have to get a command line tool for the job?
Cheers
- Alex
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Hello,
Just add all the XML files to the same project, for example by right clicking on a folder node of the Project view tree and selecting Add files, select all of them in the project tree with Ctrl + left click, right click again and run the action Transform with .... This will allow you to select a transformation scenario which will be applied to each selected file without opening it in an editor panel. Also you can apply to each selected file the scenario associated with it using the action Apply transformation scenario instead of Transform with .... The actions are explained in the User Manual (the list of 3 actions) before the beginning of the section Built-in transformation scenarios.
Regards,
Sorin
Just add all the XML files to the same project, for example by right clicking on a folder node of the Project view tree and selecting Add files, select all of them in the project tree with Ctrl + left click, right click again and run the action Transform with .... This will allow you to select a transformation scenario which will be applied to each selected file without opening it in an editor panel. Also you can apply to each selected file the scenario associated with it using the action Apply transformation scenario instead of Transform with .... The actions are explained in the User Manual (the list of 3 actions) before the beginning of the section Built-in transformation scenarios.
Regards,
Sorin
-
- Posts: 32
- Joined: Wed Jan 25, 2006 5:43 pm
Hi sorin,
thanks for your answer. Actually I'm satisfied with selecting the files in the project view and then choosing "Validate selection" - somehow I overlooked the "project"-feature, so thanks for pointing me to it.
Still my question remains. Is there a way of validating multiple file by just using XML and XSLT???
Kind Regards
- Alex
thanks for your answer. Actually I'm satisfied with selecting the files in the project view and then choosing "Validate selection" - somehow I overlooked the "project"-feature, so thanks for pointing me to it.
Still my question remains. Is there a way of validating multiple file by just using XML and XSLT???
Kind Regards
- Alex
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Hi,
Do you want to perform validation of the XML source of an XSLT transformation when the transformation is applied ? In that case you need an XSLT 2.0 schema aware transformation engine, for example Saxon 8 SA. If not then I do not understand what you want to do. Please try to describe what you need more clearly.
Regards,
Sorin
Do you want to perform validation of the XML source of an XSLT transformation when the transformation is applied ? In that case you need an XSLT 2.0 schema aware transformation engine, for example Saxon 8 SA. If not then I do not understand what you want to do. Please try to describe what you need more clearly.
Regards,
Sorin
-
- Posts: 32
- Joined: Wed Jan 25, 2006 5:43 pm
Hi,
actually I just want to validate multiple XML files in one single step, what I can do using the project view tree as you told me.
I came up with the use of XSLT only because I thought the document() function would automatically validate each document it opens - which it does not as it seems. So I'm wondering if it is possible to create an XML/XSLT document that will do the job when being validated or transformed.
Regards
- Alex
actually I just want to validate multiple XML files in one single step, what I can do using the project view tree as you told me.
I came up with the use of XSLT only because I thought the document() function would automatically validate each document it opens - which it does not as it seems. So I'm wondering if it is possible to create an XML/XSLT document that will do the job when being validated or transformed.
Regards
- Alex
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Hi,
If the XML files are part of the same document just include them with entity references and validate the XML file that includes the other files. If the files are independent documents validate them independently, for example with the action Validate selection. If you access the files from an XSLT stylesheet with the document() function or as the XML input source of the transformation you must use an XSLT 2.0 schema aware processor to validate them when they are loaded by the stylesheet. Without more details about the application where you need validation of multiple XML files this is what I recommend.
I hope that helps,
Sorin
If the XML files are part of the same document just include them with entity references and validate the XML file that includes the other files. If the files are independent documents validate them independently, for example with the action Validate selection. If you access the files from an XSLT stylesheet with the document() function or as the XML input source of the transformation you must use an XSLT 2.0 schema aware processor to validate them when they are loaded by the stylesheet. Without more details about the application where you need validation of multiple XML files this is what I recommend.
I hope that helps,
Sorin
-
- Posts: 32
- Joined: Wed Jan 25, 2006 5:43 pm
Hi,
yes this helps.
I show you, what I tried. First there is an XML file with a list of the files and the XSLT file applied to it
Then there is the XSLT itself (short version):
And, as I wrote earlier, I thought when the files are opened by document() they get validated.
Regards
- Alex
yes this helps.
I show you, what I tried. First there is an XML file with a list of the files and the XSLT file applied to it
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="Example_File_Validation.xslt"?>
<FileList xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FileList.xsd">
<File Name="file1.xml"/>
<File Name="file2.xml"/>
<File Name="file3.xml"/>
</FileList>
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html>
<head>
<title>XML Example Files</title>
</head>
<body>
<xsl:for-each select="FileList/File">
<xsl:apply-templates select="document(@Name)"/>
<p><xsl:value-of select="@Name"/></p>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Regards
- Alex
-
- Posts: 4141
- Joined: Fri Mar 28, 2003 2:12 pm
Post by sorin_ristache »
Hello,
Yes the files file1.xml, file2.xml and file3.xml get validated when they are opened by the document() function on the line
but only if the XSLT transformation is executed with an XSLT 2.0 schema aware processor, for example Saxon 8 SA.
Regards,
Sorin
Yes the files file1.xml, file2.xml and file3.xml get validated when they are opened by the document() function on the line
Code: Select all
<xsl:apply-templates select="document(@Name)"/>
Regards,
Sorin
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service