1 package com.icl.saxon.style; 2 import com.icl.saxon.tree.AttributeCollection; 3 import com.icl.saxon.*; 4 5 import com.icl.saxon.om.NamePool; 6 import com.icl.saxon.om.Name; 7 import com.icl.saxon.om.NamespaceException; 8 import com.icl.saxon.expr.*; 9 import com.icl.saxon.output.*; 10 import org.xml.sax.*; 11 import java.io.*; 12 import java.util.*; 13 import java.text.*; 14 import javax.xml.transform.*; 15 16 19 20 public class XSLOutput extends XSLGeneralOutput { 21 22 public void prepareAttributes() throws TransformerConfigurationException { 23 super.prepareAttributes(); 24 if (href!=null) { 25 compileError("The href attribute is not allowed on this element"); 26 } 27 } 28 29 public void validate() throws TransformerConfigurationException { 30 checkTopLevel(); 31 checkEmpty(); 32 33 35 if (!forwardsCompatibleModeIsEnabled()) { 36 AttributeCollection atts = getAttributeList(); 37 for (int a=0; a<atts.getLength(); a++) { 38 if (atts.getValue(a).indexOf('{') >= 0) { 39 compileError("To use attribute value templates in xsl:output, set xsl:stylesheet version='1.1'"); 40 break; 41 } 42 } 43 } 44 } 45 46 public void process(Context context) throws TransformerException {} 47 48 51 52 protected Properties gatherOutputProperties(Properties details) { 53 StandardNames sn = getStandardNames(); 54 AttributeCollection atts = getAttributeList(); 55 if (method != null) { 56 details.put(OutputKeys.METHOD, 57 atts.getValueByFingerprint(sn.METHOD)); 58 } 59 60 if (version != null) { 61 details.put(OutputKeys.VERSION, 62 atts.getValueByFingerprint(sn.VERSION)); 63 } 64 65 if (indent != null) { 66 details.put(OutputKeys.INDENT, 67 atts.getValueByFingerprint(sn.INDENT)); 68 } 69 70 if (indentSpaces != null) { 71 details.put(SaxonOutputKeys.INDENT_SPACES, 72 atts.getValueByFingerprint(sn.SAXON_INDENT_SPACES)); 73 } 74 75 if (encoding != null) { 76 details.put(OutputKeys.ENCODING, 77 atts.getValueByFingerprint(sn.ENCODING)); 78 } 79 80 if (mediaType != null) { 81 details.put(OutputKeys.MEDIA_TYPE, 82 atts.getValueByFingerprint(sn.MEDIA_TYPE)); 83 } 84 85 if (doctypeSystem != null) { 86 details.put(OutputKeys.DOCTYPE_SYSTEM, 87 atts.getValueByFingerprint(sn.DOCTYPE_SYSTEM)); 88 } 89 90 if (doctypePublic != null) { 91 details.put(OutputKeys.DOCTYPE_PUBLIC, 92 atts.getValueByFingerprint(sn.DOCTYPE_PUBLIC)); 93 } 94 95 if (omitDeclaration != null) { 96 details.put(OutputKeys.OMIT_XML_DECLARATION, 97 atts.getValueByFingerprint(sn.OMIT_XML_DECLARATION)); 98 } 99 100 if (standalone != null) { 101 details.put(OutputKeys.STANDALONE, 102 atts.getValueByFingerprint(sn.STANDALONE)); 103 } 104 105 if (cdataElements != null) { 106 String existing = details.getProperty(OutputKeys.CDATA_SECTION_ELEMENTS); 107 String s = existing + " " + atts.getValueByFingerprint(sn.CDATA_SECTION_ELEMENTS); 108 details.put(OutputKeys.CDATA_SECTION_ELEMENTS, s); 109 } 110 111 if (nextInChain != null) { 113 } 114 115 return details; 116 } 117 } 118 119 | Popular Tags |