本文整理汇总了Java中com.icl.saxon.Context.getController方法的典型用法代码示例。如果您正苦于以下问题:Java Context.getController方法的具体用法?Java Context.getController怎么用?Java Context.getController使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.icl.saxon.Context
的用法示例。
在下文中一共展示了Context.getController方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: unwrapLinks
import com.icl.saxon.Context; //导入方法依赖的package包/类
/**
* <p>Unwrap links</p>
*
* @param rtf The result tree fragment of the verbatim environment.
*
* @return The modified result tree fragment.
*/
public static NodeSetValue unwrapLinks (Context context,
NodeSetValue rtf_ns) {
FragmentValue rtf = (FragmentValue) rtf_ns;
boolean tryAgain = true;
setupUnwrapLinks(context);
try {
Controller controller = context.getController();
NamePool namePool = controller.getNamePool();
while (tryAgain) {
UnwrapLinksEmitter ulEmitter = new UnwrapLinksEmitter(controller,
namePool,
foStylesheet);
rtf.replay(ulEmitter);
tryAgain = ulEmitter.tryAgain();
rtf = (FragmentValue) ulEmitter.getResultTreeFragment();
}
return rtf;
} catch (TransformerException e) {
// This "can't" happen.
System.out.println("Transformer Exception in unwrapLinks");
return rtf;
}
}
示例2: unwrapLinks
import com.icl.saxon.Context; //导入方法依赖的package包/类
/**
* <p>Unwrap links</p>
*
* @param context The current stylesheet context.
* @param rtf_ns The result tree fragment of the verbatim environment.
*
* @return The modified result tree fragment.
*/
public static NodeSetValue unwrapLinks (Context context,
NodeSetValue rtf_ns) {
FragmentValue rtf = (FragmentValue) rtf_ns;
boolean tryAgain = true;
setupUnwrapLinks(context);
try {
Controller controller = context.getController();
NamePool namePool = controller.getNamePool();
while (tryAgain) {
UnwrapLinksEmitter ulEmitter = new UnwrapLinksEmitter(controller,
namePool,
foStylesheet);
rtf.replay(ulEmitter);
tryAgain = ulEmitter.tryAgain();
rtf = (FragmentValue) ulEmitter.getResultTreeFragment();
}
return rtf;
} catch (TransformerException e) {
// This "can't" happen.
System.out.println("Transformer Exception in unwrapLinks");
return rtf;
}
}
示例3: insertCallouts
import com.icl.saxon.Context; //导入方法依赖的package包/类
/**
* <p>Insert text callouts into a verbatim environment.</p>
*
* <p>This method examines the <tt>areaset</tt> and <tt>area</tt> elements
* in the supplied <tt>areaspec</tt> and decorates the supplied
* result tree fragment with appropriate callout markers.</p>
*
* <p>If a <tt>label</tt> attribute is supplied on an <tt>area</tt>,
* its content will be used for the label, otherwise the callout
* number will be used, surrounded by parenthesis. Callout numbers may
* also be represented as graphics. Callouts are
* numbered in document order. All of the <tt>area</tt>s in an
* <tt>areaset</tt> get the same number.</p>
*
* <p>Only the <tt>linecolumn</tt> and <tt>linerange</tt> units are
* supported. If no unit is specifed, <tt>linecolumn</tt> is assumed.
* If only a line is specified, the callout decoration appears in
* the defaultColumn. Lines will be padded with blanks to reach the
* necessary column, but callouts that are located beyond the last
* line of the verbatim environment will be ignored.</p>
*
* <p>Callouts are inserted before the character at the line/column
* where they are to occur.</p>
*
* <p>If graphical callouts are used, and the callout number is less
* than or equal to the $callout.graphics.number.limit, the following image
* will be generated for HTML:
*
* <pre>
* <img src="$callout.graphics.path/999$callout.graphics.ext"
* alt="conumber">
* </pre>
*
* If the $stylesheet.result.type is 'fo', the following image will
* be generated:
*
* <pre>
* <fo:external-graphic src="$callout.graphics.path/999$callout.graphics.ext"/>
* </pre>
*
* <p>If the callout number exceeds $callout.graphics.number.limit,
* the callout will be the callout number surrounded by
* parenthesis.</p>
*
* @param context The stylesheet context.
* @param areaspecNodeList The source node set that contains the areaspec.
* @param rtf_ns The result tree fragment of the verbatim environment.
*
* @return The modified result tree fragment.
*/
public static NodeSetValue insertCallouts (Context context,
NodeList areaspecNodeList,
NodeSetValue rtf_ns) {
FragmentValue rtf = (FragmentValue) rtf_ns;
setupCallouts(context);
try {
Controller controller = context.getController();
NamePool namePool = controller.getNamePool();
CalloutEmitter cEmitter = new CalloutEmitter(controller,
namePool,
defaultColumn,
foStylesheet,
fCallout);
cEmitter.setupCallouts(areaspecNodeList);
rtf.replay(cEmitter);
return cEmitter.getResultTreeFragment();
} catch (TransformerException e) {
// This "can't" happen.
System.out.println("Transformer Exception in insertCallouts");
return rtf;
}
}
示例4: numberLines
import com.icl.saxon.Context; //导入方法依赖的package包/类
/**
* <p>Number lines in a verbatim environment</p>
*
* <p>The extension function expects the following variables to be
* available in the calling context: $linenumbering.everyNth,
* $linenumbering.width, $linenumbering.separator, and
* $stylesheet.result.type.</p>
*
* <p>This method adds line numbers to a result tree fragment. Each
* newline that occurs in a text node is assumed to start a new line.
* The first line is always numbered, every subsequent 'everyNth' line
* is numbered (so if everyNth=5, lines 1, 5, 10, 15, etc. will be
* numbered. If there are fewer than everyNth lines in the environment,
* every line is numbered.</p>
*
* <p>Every line number will be right justified in a string 'width'
* characters long. If the line number of the last line in the
* environment is too long to fit in the specified width, the width
* is automatically increased to the smallest value that can hold the
* number of the last line. (In other words, if you specify the value 2
* and attempt to enumerate the lines of an environment that is 100 lines
* long, the value 3 will automatically be used for every line in the
* environment.)</p>
*
* <p>The 'separator' string is inserted between the line
* number and the original program listing. Lines that aren't numbered
* are preceded by a 'width' blank string and the separator.</p>
*
* <p>If inline markup extends across line breaks, markup changes are
* required. All the open elements are closed before the line break and
* "reopened" afterwards. The reopened elements will have the same
* attributes as the originals, except that 'name' and 'id' attributes
* are not duplicated if the stylesheet.result.type is "html" and
* 'id' attributes will not be duplicated if the result type is "fo".</p>
*
* @param rtf The result tree fragment of the verbatim environment.
*
* @return The modified result tree fragment.
*/
public static NodeSetValue numberLines (Context context,
NodeSetValue rtf_ns) {
FragmentValue rtf = (FragmentValue) rtf_ns;
setupLineNumbering(context);
try {
LineCountEmitter lcEmitter = new LineCountEmitter();
rtf.replay(lcEmitter);
int numLines = lcEmitter.lineCount();
int listingModulus = numLines < modulus ? 1 : modulus;
double log10numLines = Math.log(numLines) / Math.log(10);
int listingWidth = width < log10numLines+1
? (int) Math.floor(log10numLines + 1)
: width;
Controller controller = context.getController();
NamePool namePool = controller.getNamePool();
NumberLinesEmitter nlEmitter = new NumberLinesEmitter(controller,
namePool,
startinglinenumber,
listingModulus,
listingWidth,
separator,
foStylesheet);
rtf.replay(nlEmitter);
return nlEmitter.getResultTreeFragment();
} catch (TransformerException e) {
// This "can't" happen.
System.out.println("Transformer Exception in numberLines");
return rtf;
}
}
示例5: insertCallouts
import com.icl.saxon.Context; //导入方法依赖的package包/类
/**
* <p>Insert text callouts into a verbatim environment.</p>
*
* <p>This method examines the <tt>areaset</tt> and <tt>area</tt> elements
* in the supplied <tt>areaspec</tt> and decorates the supplied
* result tree fragment with appropriate callout markers.</p>
*
* <p>If a <tt>label</tt> attribute is supplied on an <tt>area</tt>,
* its content will be used for the label, otherwise the callout
* number will be used, surrounded by parenthesis. Callout numbers may
* also be represented as graphics. Callouts are
* numbered in document order. All of the <tt>area</tt>s in an
* <tt>areaset</tt> get the same number.</p>
*
* <p>Only the <tt>linecolumn</tt> and <tt>linerange</tt> units are
* supported. If no unit is specifed, <tt>linecolumn</tt> is assumed.
* If only a line is specified, the callout decoration appears in
* the defaultColumn. Lines will be padded with blanks to reach the
* necessary column, but callouts that are located beyond the last
* line of the verbatim environment will be ignored.</p>
*
* <p>Callouts are inserted before the character at the line/column
* where they are to occur.</p>
*
* <p>If graphical callouts are used, and the callout number is less
* than or equal to the $callout.graphics.number.limit, the following image
* will be generated for HTML:
*
* <pre>
* <img src="$callout.graphics.path/999$callout.graphics.ext"
* alt="conumber">
* </pre>
*
* If the $stylesheet.result.type is 'fo', the following image will
* be generated:
*
* <pre>
* <fo:external-graphic src="$callout.graphics.path/999$callout.graphics.ext"/>
* </pre>
*
* <p>If the callout number exceeds $callout.graphics.number.limit,
* the callout will be the callout number surrounded by
* parenthesis.</p>
*
* @param context The stylesheet context.
* @param areaspecNodeSet The source node set that contains the areaspec.
* @param rtf The result tree fragment of the verbatim environment.
*
* @return The modified result tree fragment.
*/
public static NodeSetValue insertCallouts (Context context,
NodeList areaspecNodeList,
NodeSetValue rtf_ns) {
FragmentValue rtf = (FragmentValue) rtf_ns;
setupCallouts(context);
try {
Controller controller = context.getController();
NamePool namePool = controller.getNamePool();
CalloutEmitter cEmitter = new CalloutEmitter(controller,
namePool,
defaultColumn,
foStylesheet,
fCallout);
cEmitter.setupCallouts(areaspecNodeList);
rtf.replay(cEmitter);
return cEmitter.getResultTreeFragment();
} catch (TransformerException e) {
// This "can't" happen.
System.out.println("Transformer Exception in insertCallouts");
return rtf;
}
}
示例6: numberLines
import com.icl.saxon.Context; //导入方法依赖的package包/类
/**
* <p>Number lines in a verbatim environment</p>
*
* <p>The extension function expects the following variables to be
* available in the calling context: $linenumbering.everyNth,
* $linenumbering.width, $linenumbering.separator, and
* $stylesheet.result.type.</p>
*
* <p>This method adds line numbers to a result tree fragment. Each
* newline that occurs in a text node is assumed to start a new line.
* The first line is always numbered, every subsequent 'everyNth' line
* is numbered (so if everyNth=5, lines 1, 5, 10, 15, etc. will be
* numbered. If there are fewer than everyNth lines in the environment,
* every line is numbered.</p>
*
* <p>Every line number will be right justified in a string 'width'
* characters long. If the line number of the last line in the
* environment is too long to fit in the specified width, the width
* is automatically increased to the smallest value that can hold the
* number of the last line. (In other words, if you specify the value 2
* and attempt to enumerate the lines of an environment that is 100 lines
* long, the value 3 will automatically be used for every line in the
* environment.)</p>
*
* <p>The 'separator' string is inserted between the line
* number and the original program listing. Lines that aren't numbered
* are preceded by a 'width' blank string and the separator.</p>
*
* <p>If inline markup extends across line breaks, markup changes are
* required. All the open elements are closed before the line break and
* "reopened" afterwards. The reopened elements will have the same
* attributes as the originals, except that 'name' and 'id' attributes
* are not duplicated if the stylesheet.result.type is "html" and
* 'id' attributes will not be duplicated if the result type is "fo".</p>
*
* @param context The current stylesheet context.
* @param rtf_ns The result tree fragment of the verbatim environment.
*
* @return The modified result tree fragment.
*/
public static NodeSetValue numberLines (Context context,
NodeSetValue rtf_ns) {
FragmentValue rtf = (FragmentValue) rtf_ns;
setupLineNumbering(context);
try {
LineCountEmitter lcEmitter = new LineCountEmitter();
rtf.replay(lcEmitter);
int numLines = lcEmitter.lineCount();
int listingModulus = numLines < modulus ? 1 : modulus;
double log10numLines = Math.log(numLines) / Math.log(10);
int listingWidth = width < log10numLines+1
? (int) Math.floor(log10numLines + 1)
: width;
Controller controller = context.getController();
NamePool namePool = controller.getNamePool();
NumberLinesEmitter nlEmitter = new NumberLinesEmitter(controller,
namePool,
startinglinenumber,
listingModulus,
listingWidth,
separator,
foStylesheet);
rtf.replay(nlEmitter);
return nlEmitter.getResultTreeFragment();
} catch (TransformerException e) {
// This "can't" happen.
System.out.println("Transformer Exception in numberLines");
return rtf;
}
}