本文整理了Java中javax.xml.transform.Templates.getOutputProperties()
方法的一些代码示例,展示了Templates.getOutputProperties()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Templates.getOutputProperties()
方法的具体详情如下:
包路径:javax.xml.transform.Templates
类名称:Templates
方法名:getOutputProperties
[英]Get the properties corresponding to the effective xsl:output element. The object returned will be a clone of the internal values. Accordingly, it can be mutated without mutating the Templates object, and then handed in to javax.xml.transform.Transformer#setOutputProperties.
The properties returned should contain properties set by the stylesheet, and these properties are "defaulted" by default properties specified by section 16 of the XSL Transformations (XSLT) W3C Recommendation. The properties that were specifically set by the stylesheet should be in the base Properties list, while the XSLT default properties that were not specifically set should be in the "default" Properties list. Thus, getOutputProperties().getProperty(String key) will obtain any property in that was set by the stylesheet, or the default properties, while getOutputProperties().get(String key) will only retrieve properties that were explicitly set in the stylesheet.
For XSLT, Attribute Value Templates attribute values will be returned unexpanded (since there is no context at this point). The namespace prefixes inside Attribute Value Templates will be unexpanded, so that they remain valid XPath values.
[中]获取与有效xsl:output元素对应的属性。返回的对象将是内部值的克隆。因此,它可以在不改变Templates对象的情况下进行改变,然后交给javax。xml。使改变Transformer#setOutputProperties。
返回的属性应该包含样式表设置的属性,这些属性是由section 16 of the XSL Transformations (XSLT) W3C Recommendation指定的默认属性“defaulted”。样式表专门设置的属性应该在基本属性列表中,而没有专门设置的XSLT默认属性应该在“默认”属性列表中。因此,getOutputProperties()。getProperty(字符串键)将获取由样式表设置的任何属性,或默认属性,而getOutputProperties()将获取这些属性。get(字符串键)将只检索在样式表中显式设置的属性。
对于XSLT,Attribute Value Templates属性值将返回未展开(因为此时没有上下文)。属性值模板中的名称空间前缀将不展开,因此它们仍然是有效的XPath值。
代码示例来源:origin: xalan/xalan
stylesheet.getOutputProperties();
代码示例来源:origin: org.smartdeveloperhub.harvesters.ci.util/ci-util-xml
@Override
public Properties getOutputProperties() {
return templates.getOutputProperties();
}
代码示例来源:origin: apache/cxf
public Properties getOutputProperties() {
return templates.getOutputProperties();
}
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
public Properties getOutputProperties() {
return templates.getOutputProperties();
}
代码示例来源:origin: org.pageseeder.berlioz/pso-berlioz
/**
* Sets the output properties of this transform result.
*
* @see <a href="http://www.w3.org/TR/xslt20/#element-output">XSLT 2.0 - 20 Serialization</a>
*
* @param templates the templates used to generate this.
*/
protected void setOutputProperties(Templates templates) {
Properties p = templates.getOutputProperties();
this.encoding = p.getProperty("encoding", "utf-8");
this.mediaType = p.getProperty("media-type", "text/html");
}
代码示例来源:origin: net.sourceforge.saxon/saxon
/**
* Make an output file in the output directory, with filename extension derived from the
* media-type produced by the stylesheet
*
* @param directory The directory in which the file is to be created
* @param localName The local name of the file within the
* directory, excluding the file type suffix
* @param sheet The Templates object identifying the stylesheet -
* used to determine the output method, and hence the suffix to be
* used for the filename
* @return The newly created file
*/
private File makeOutputFile(File directory, String localName, Templates sheet) {
String mediaType = sheet.getOutputProperties().getProperty(OutputKeys.MEDIA_TYPE);
String suffix = ".xml";
if ("text/html".equals(mediaType)) {
suffix = ".html";
} else if ("text/plain".equals(mediaType)) {
suffix = ".txt";
}
String prefix = localName;
if (localName.endsWith(".xml") || localName.endsWith(".XML")) {
prefix = localName.substring(0, localName.length() - 4);
}
return new File(directory, prefix + suffix);
}
代码示例来源:origin: org.opengis.cite.saxon/saxon9
/**
* Make an output file in the output directory, with filename extension derived from the
* media-type produced by the stylesheet
*
* @param directory The directory in which the file is to be created
* @param localName The local name of the file within the
* directory, excluding the file type suffix
* @param sheet The Templates object identifying the stylesheet -
* used to determine the output method, and hence the suffix to be
* used for the filename
* @return The newly created file
*/
private File makeOutputFile(File directory, String localName,
Templates sheet) {
String mediaType = sheet.getOutputProperties().getProperty(OutputKeys.MEDIA_TYPE);
String suffix = ".xml";
if ("text/html".equals(mediaType)) {
suffix = ".html";
} else if ("text/plain".equals(mediaType)) {
suffix = ".txt";
}
String prefix = localName;
if (localName.endsWith(".xml") || localName.endsWith(".XML")) {
prefix = localName.substring(0, localName.length() - 4);
}
return new File(directory, prefix + suffix);
}
代码示例来源:origin: webwork/webwork-jira
Transformer transformer = templates.newTransformer();
String mimeType = templates.getOutputProperties().getProperty(OutputKeys.MEDIA_TYPE);
if (mimeType == null) {
代码示例来源:origin: com.opensymphony/webwork
mimeType = "text/xml"; // no stylesheet, raw xml
else
mimeType = templates.getOutputProperties().getProperty(OutputKeys.MEDIA_TYPE);
if (mimeType == null) {
代码示例来源:origin: org.carrot2/carrot2-core
final Properties outputProps = template.getOutputProperties();
final String encoding;
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
stylesheet.getOutputProperties();
代码示例来源:origin: com.caucho/resin
path.getParent().mkdirs();
Properties output = stylesheet.getOutputProperties();
代码示例来源:origin: org.apache.xalan/com.springsource.org.apache.xalan
stylesheet.getOutputProperties();
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.xalan
stylesheet.getOutputProperties();
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
stylesheet.getOutputProperties();
代码示例来源:origin: org.apache.karaf.bundles/org.apache.karaf.bundles.xalan-2.7.1
stylesheet.getOutputProperties();
代码示例来源:origin: com.caucho/resin
Properties output = stylesheet.getOutputProperties();
内容来源于网络,如有侵权,请联系作者删除!