public class XsltGenerator extends Object implements XsltConstants
Alignment
. Each generation
process has to use its own instance.NS_CUSTOM_XSL, NS_PREFIX_CUSTOM_XSL, NS_PREFIX_XS, NS_PREFIX_XSI, NS_PREFIX_XSL, NS_PREFIX_XSL_DEFINITIONS, NS_URI_XSL, NS_XSL_DEFINITIONS
Constructor and Description |
---|
XsltGenerator(File workDir,
Alignment alignment,
XmlIndex sourceSchema,
XmlIndex targetSchema,
IOReporter reporter,
ProgressIndicator progress,
XmlElement containerElement,
SourceContextProvider sourceContext,
ProjectInfo projectInfo)
Create a XSLT generator.
|
Modifier and Type | Method and Description |
---|---|
protected DefinitionPath |
findMemberAttribute(XmlElement container,
TypeDefinition memberType)
Find a matching attribute for the given member type in the given
container type
|
protected void |
generateContainer(Set<String> typeIds,
File templateFile,
Map<String,QName> targetElements)
Generate a XSL fragment that is the root of transformed target files and
incorporates the results of type transformation that are store as
temporary documents in XSL variables.
|
protected void |
generateTypeTransformation(String templateName,
XmlElement targetElement,
Cell typeCell,
File targetfile)
Generate a XSL fragment for transformation based on the given type
relation.
|
IOReport |
write(LocatableOutputSupplier<? extends OutputStream> target)
Generate the XSLT transformation and write it to the given target.
|
protected void |
writeContainerIntro(XMLStreamWriter writer,
XsltGenerationContext context)
Write additional content into the container before it is populated by the
type relations.
|
public XsltGenerator(File workDir, Alignment alignment, XmlIndex sourceSchema, XmlIndex targetSchema, IOReporter reporter, ProgressIndicator progress, XmlElement containerElement, SourceContextProvider sourceContext, ProjectInfo projectInfo) throws Exception
workDir
- the working directory where the generator may store
temporary files, the caller is responsible for cleaning this
up, e.g. after write(LocatableOutputSupplier)
was
calledalignment
- the alignmentsourceSchema
- the source schematargetSchema
- the target schemareporter
- the reporter for documenting errorsprogress
- the progress indicator for indicating the generation
progresscontainerElement
- the name of the element to serve as document root
in the target XML filesourceContext
- an optional custom source context providerprojectInfo
- the project info, if available, may be
null
Exception
- if an error occurs initializing the generatorpublic IOReport write(LocatableOutputSupplier<? extends OutputStream> target) throws Exception
target
- the target output supplierException
- if a unrecoverable error occurs during the processprotected void generateContainer(Set<String> typeIds, File templateFile, Map<String,QName> targetElements) throws XMLStreamException, IOException
typeIds
- the identifiers of the type transformations, they are also
the names of the variables holding the temporary documentstemplateFile
- the file to write the fragment totargetElements
- an empty map that is populated with variable names
mapped to target element namesIOException
- if an error occurs writing the templateXMLStreamException
- if an error occurs writing XML content to the
templateprotected void writeContainerIntro(XMLStreamWriter writer, XsltGenerationContext context) throws XMLStreamException, IOException
writer
- the XML stream writercontext
- the XSLT generation contextXMLStreamException
- if an error occurs while writing to the
containerIOException
- if an error occurs writing to the fileprotected DefinitionPath findMemberAttribute(XmlElement container, TypeDefinition memberType)
container
- the container elementmemberType
- the member typenull
protected void generateTypeTransformation(String templateName, XmlElement targetElement, Cell typeCell, File targetfile) throws TransformationException
templateName
- name of the XSL templatetypeCell
- the type relationtargetfile
- the target file to write the fragment totargetElement
- the target element to use to hold a transformed
instanceTransformationException
- if an unrecoverable error occurs during
the XSLT transformation generationBuild 2013-10-07_11-27-38
Revision 99b27713a799a59a21b0b166eaaea8aaefbf125a