Project

Profile

Help

Revision 80f57037

Added by Michael Kay 10 months ago

Fix bug 4886 (TVTs)

View differences:

src/main/java/net/sf/saxon/style/StyleElement.java
529 529
        processDefaultMode();
530 530
        staticContext = new ExpressionContext(this, null);
531 531
        processAttributes();
532
        for (NodeInfo child : children(StyleElement.class::isInstance)) {
533
            ((StyleElement) child).processAllAttributes();
532
        for (NodeInfo child : children()) {
533
            if (child instanceof StyleElement) {
534
                ((StyleElement) child).processAllAttributes();
535
            } else if (child instanceof TextValueTemplateNode) {
536
                ((TextValueTemplateNode)child).parse();
537
            }
534 538
        };
535 539
    }
536 540

  
......
1741 1745
    }
1742 1746

  
1743 1747
    /**
1744
     * Examine a text node in the stylesheet to see if it is a text value template
1748
     * Examine a text node in the stylesheet to see if it is a text value template;
1749
     * at the same time, perform type-checking on any contained expressions.
1745 1750
     *
1746 1751
     * @param node the text node
1747
     * @throws XPathException if the node is is a text value template with variable content
1752
     * @return true if the node is is a text value template with variable content
1753
     * @throws XPathException if type checking of a TVT fails.
1748 1754
     */
1749 1755

  
1750 1756
    private boolean examineTextNode(NodeInfo node) throws XPathException {
src/main/java/net/sf/saxon/style/TextValueTemplateNode.java
38 38
        return staticContext;
39 39
    }
40 40

  
41
    public void validate() throws XPathException {
41
    /**
42
     * Parse any XPath expressions contained in the content of the text value template
43
     * @throws XPathException if parsing of an XPath expression fails
44
     */
45
    public void parse() throws XPathException {
42 46
        boolean disable = false;
43 47
        NodeInfo parent = getParent();
44
        if (parent instanceof XSLText && isYes(parent.getAttributeValue("","disable-output-escaping"))) {
48
        if (parent instanceof XSLText && isYes(parent.getAttributeValue("", "disable-output-escaping"))) {
45 49
            disable = true;
46 50
        }
47 51
        contentExp = AttributeValueTemplate.make(getStringValue(), getStaticContext());
48 52
        contentExp = new ValueOf(contentExp, disable, false);
49
        contentExp.setRetainedStaticContext(((StyleElement)getParent()).makeRetainedStaticContext());
53
        assert getParent() != null;
54
        contentExp.setRetainedStaticContext(((StyleElement) getParent()).makeRetainedStaticContext());
55
    }
56

  
57
    /**
58
     * Validate the text node; specifically, perform type checking of any contained expressions
59
     * @throws XPathException if type checking finds any problems
60
     */
61
    public void validate() throws XPathException {
62
        assert getParent() != null;
50 63
        contentExp = ((StyleElement)getParent()).typeCheck("tvt", contentExp);
51 64
    }
52 65
}

Also available in: Unified diff