0001: /*
0002: * Copyright 2001 Sun Microsystems, Inc. All rights reserved.
0003: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
0004: */
0005: package com.sun.portal.rewriter.engines.xml.test;
0006:
0007: import com.sun.portal.rewriter.Rewriter;
0008: import com.sun.portal.rewriter.RewriterModule;
0009: import com.sun.portal.rewriter.RewriterPool;
0010: import com.sun.portal.rewriter.engines.LanguageConstants;
0011: import com.sun.portal.rewriter.rom.RuleSet;
0012: import com.sun.portal.rewriter.test.util.BasicTestCase;
0013: import com.sun.portal.rewriter.test.util.BasicXMLTestCase;
0014: import com.sun.portal.rewriter.test.util.CreateRuleSet;
0015: import junit.framework.TestSuite;
0016:
0017: public class TestXMLAttributes extends BasicXMLTestCase {
0018: public TestXMLAttributes(String aName) {
0019: super (aName);
0020: }//constuctor
0021:
0022: public void testNameSpaceAttribute() throws Exception {
0023: String lInput = "<a:multistatus xmlns:a=\"DAV:\">\n"
0024: + "<a:href rajaAttrib=\"raja.html,3,movie.html\"/>\n"
0025: + "</a:multistatus>";
0026:
0027: String lExpectation = "<a:multistatus xmlns:a=\"DAV:\">\n"
0028: + "<a:href rajaAttrib=\"http://rajanagendra.sun.com/Base/Raja/raja.html,3,http://rajanagendra.sun.com/Base/Raja/movie.html\"/>\n"
0029: + "</a:multistatus>";
0030:
0031: String[] lAttributeRules = {
0032: "<Attribute name=\"rajaAttrib\" valuePatterns=\"**,3,**html\" />", //4
0033: "<Attribute name=\"rajaAttrib\" tag=\"*\" valuePatterns=\"**,3,**html\" />", //4
0034: "<Attribute name=\"rajaAttrib\" tag=\"a:*\" valuePatterns=\"**,3,**html\" />", //4
0035: "<Attribute name=\"rajaAttrib\" tag=\"*href\" valuePatterns=\"**,3,**html\" />", //4
0036: "<Attribute name=\"rajaAttrib\" tag=\"*:href\" valuePatterns=\"**,3,**html\" />", //4
0037: "<Attribute name=\"rajaAttrib\" tag=\"a*href\" valuePatterns=\"**,3,**html\" />", //4
0038: "<Attribute name=\"rajaAttrib\" tag=\"a:*href\" valuePatterns=\"**,3,**html\" />", //4
0039: "<Attribute name=\" rajaAttrib \" tag=\"a:*href\" valuePatterns=\"**,3,**html\" />", //4
0040: "<Attribute name=\"rajaAttrib \" tag=\" a:*href \" valuePatterns=\"**,3,**html \" />", //4
0041: "<Attribute name=\"rajaAttrib\" tag=\"a:*href\" valuePatterns=\" **,3,**html \" />", //4
0042:
0043: "<Attribute name=\";*\" tag=\"a:*href\" valuePatterns=\"**,3,**html\" />", //4
0044: "<Attribute name=\";*;\" tag=\"a:*href\" valuePatterns=\"**,3,**html\" />", //4
0045: "<Attribute name=\"*;\" tag=\"a:*href\" valuePatterns=\"**,3,**html\" />", //4
0046: //"<Attribute name=\" \" tag=\"a:*href\" valuePatterns=\"**,3,**html\" />", //4
0047: //"<Attribute name=\"\" tag=\"a:*href\" valuePatterns=\"**,3,**html\" />", //4
0048: //"<Attribute name=\"*\" tag=\"a:*href\" valuePatterns=\"**,3,**html\" />", //4
0049: };
0050:
0051: for (int i = 0; i < lAttributeRules.length; i++) {
0052: RuleSet lRuleSet = CreateRuleSet
0053: .withXMLAttributeRules(lAttributeRules[i]);
0054: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0055: LanguageConstants.XML_MIME);
0056: String lResult = lRewriter.rewrite(lInput,
0057: getDefaultTranslator());
0058: assertXMLEqual("Failed at i=" + i, lExpectation, lResult);
0059: }//for loop
0060:
0061: }//testNameSpaceAttribute()
0062:
0063: public void testXMLParser() throws Exception {
0064: String lInput = "<a:multistatus xmlns:a=\"DAV:\">"
0065: + "<a:href rajaAttrib=\"raja.html,3,movie.html\"/>"
0066: + "</a:multistatus>";
0067:
0068: String lExpectation = "<a:multistatus xmlns:a=\"DAV:\">"
0069: + "<a:href rajaAttrib=\"http://rajanagendra.sun.com/Base/Raja/raja.html,3,http://rajanagendra.sun.com/Base/Raja/movie.html\"/>"
0070: + "</a:multistatus>";
0071:
0072: String[] lAttributeRules = {
0073: "<Attribute name=\"rajaAttrib\" valuePatterns=\"**,3,**html\" />", //0
0074: "<Attribute name=\"rajaAttrib\" tag=\"*\" valuePatterns=\"**,3,**html\" />", //1
0075: "<Attribute name=\"rajaAttrib\" tag=\"a:*\" valuePatterns=\"**,3,**html\" />", //2
0076: "<Attribute name=\"rajaAttrib\" tag=\"*href\" valuePatterns=\"**,3,**html\" />", //3
0077: "<Attribute name=\"rajaAttrib\" tag=\"*:href\" valuePatterns=\"**,3,**html\" />", //4
0078: "<Attribute name=\"rajaAttrib\" tag=\"a*href\" valuePatterns=\"**,3,**html\" />", //5
0079: "<Attribute name=\"rajaAttrib\" tag=\"a:*href\" valuePatterns=\"**,3,**html\" />", //6
0080: "<Attribute name=\"rajaAttrib\" tag=\"a:*href\" valuePatterns=\"**,3,**html\" source=\"*.sun.com*\"/>", //7
0081: "<Attribute name=\"rajaAttrib\" tag=\"a:*href\" valuePatterns=\"**,3,**html\" source=\"http://rajanagendra.sun.com/Base/Raja/raja.html\"/>", //8
0082: //"<Attribute name=\"rajaAttrib\" tag=\"a:*href\" valuePatterns=\"**,3,**html\" source=\"http://rajanagendra.sun.com/Base/Raja/raja.html?name=raja\"/>", //8
0083: };
0084:
0085: for (int i = 0; i < lAttributeRules.length; i++) {
0086:
0087: RuleSet lRuleSet = CreateRuleSet
0088: .withXMLAttributeRules(lAttributeRules[i]);
0089: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0090: LanguageConstants.XML_MIME);
0091: String lResult = lRewriter.rewrite(lInput,
0092: getDefaultTranslator());
0093: assertXMLEqual("Failed at i=" + i, lExpectation, lResult);
0094: }//for loop
0095: }//testXMLParser()
0096:
0097: public void testXMLParserNegativeSourceRule() throws Exception {
0098: String lInput = "<a:multistatus xmlns:a=\"DAV:\">"
0099: + "<a:href rajaAttrib=\"raja.html,3,movie.html\"/>"
0100: + "</a:multistatus>";
0101:
0102: String lExpectation = "<a:multistatus xmlns:a=\"DAV:\">"
0103: + "<a:href rajaAttrib=\"http://rajanagendra.sun.com/Base/Raja/raja.html,3,movie.html\"/>"
0104: + "</a:multistatus>";
0105:
0106: String[] lAttributeRules = {
0107: "<Attribute name=\"rajaAttrib\" valuePatterns=\"**,3,**html\" source=\"abc\"/>"
0108: + "<Attribute name=\"rajaAttrib\" valuePatterns=\"***\" />",
0109:
0110: "<Attribute name=\"rajaAttrib\" valuePatterns=\"**,3,**html\" source=\"abc\"/>"
0111: + "<Attribute name=\"rajaAttrib\" />", };
0112:
0113: for (int i = 0; i < lAttributeRules.length; i++) {
0114: RuleSet lRuleSet = CreateRuleSet
0115: .withXMLAttributeRules(lAttributeRules[i]);
0116: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0117: LanguageConstants.XML_MIME);
0118: String lResult = lRewriter.rewrite(lInput,
0119: getDefaultTranslator());
0120: assertXMLEqual("Failed at i=" + i, lExpectation, lResult);
0121: }
0122: }//testXMLParserNegativeSourceRule()
0123:
0124: public void testXMLParserNegativeSourceRule1() throws Exception {
0125: String lInput = "<a:multistatus xmlns:a=\"DAV:\">"
0126: + "<a:href rajaAttrib=\"raja.html,3,movie.html\"/>"
0127: + "</a:multistatus>";
0128:
0129: String lExpectation = "<a:multistatus xmlns:a=\"DAV:\">"
0130: + "<a:href rajaAttrib=\"raja.html,3,http://rajanagendra.sun.com/Base/Raja/movie.html\"/>"
0131: + "</a:multistatus>";
0132:
0133: String[] lAttributeRules = { "<Attribute name=\"rajaAttrib\" valuePatterns=\"**,3,**html\" source=\"abc\"/>"
0134: + "<Attribute name=\"rajaAttrib\" valuePatterns=\"*3,**\" />", };
0135: for (int i = 0; i < lAttributeRules.length; i++) {
0136: RuleSet lRuleSet = CreateRuleSet
0137: .withXMLAttributeRules(lAttributeRules[i]);
0138: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0139: LanguageConstants.XML_MIME);
0140: String lResult = lRewriter.rewrite(lInput,
0141: getDefaultTranslator());
0142: assertXMLEqual("Failed at i=" + i, lExpectation, lResult);
0143: }
0144: }//testXMLParserNegativeSourceRule1()
0145:
0146: public void testXMLParser1() throws Exception {
0147: String lInput = "<a:multistatus xmlns:a=\"DAV:\">"
0148: + "<a:href rajaAttrib=\"raja.html,3,movie.html\"/>\n"
0149: + "</a:multistatus>";
0150:
0151: String lExpectation = "<a:multistatus xmlns:a=\"DAV:\">"
0152: + "<a:href rajaAttrib=\"http://rajanagendra.sun.com/Base/Raja/raja.html,3,http://rajanagendra.sun.com/Base/Raja/movie.html\"/>\n"
0153: + "</a:multistatus>";
0154:
0155: String[] lAttributeRules = {
0156: "<Attribute name=\"rajaAttrib\" valuePatterns=\"**,3,**html\" />", //4
0157: "<Attribute name=\"rajaAttrib\" tag=\"*\" valuePatterns=\"**,3,**html\" />", //4
0158: "<Attribute name=\"rajaAttrib\" tag=\"a:*\" valuePatterns=\"**,3,**html\" />", //4
0159: "<Attribute name=\"rajaAttrib\" tag=\"*href\" valuePatterns=\"**,3,**html\" />", //4
0160: "<Attribute name=\"rajaAttrib\" tag=\"*:href\" valuePatterns=\"**,3,**html\" />", //4
0161: "<Attribute name=\"rajaAttrib\" tag=\"a*href\" valuePatterns=\"**,3,**html\" />", //4
0162: "<Attribute name=\"rajaAttrib\" tag=\"a:*href\" valuePatterns=\"**,3,**html\" />", //4
0163: };
0164:
0165: for (int i = 0; i < lAttributeRules.length; i++) {
0166:
0167: RuleSet lRuleSet = CreateRuleSet
0168: .withXMLAttributeRules(lAttributeRules[i]);
0169: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0170: LanguageConstants.XML_MIME);
0171: String lResult = lRewriter.rewrite(lInput,
0172: getDefaultTranslator());
0173: assertXMLEqual("Failed at i=" + i, lExpectation, lResult);
0174: }//for loop
0175:
0176: }//testXMLParser()
0177:
0178: public void testXMLParser2() throws Exception {
0179: String lInput = "<a:multistatus xmlns:a=\"DAV:\">\n\t\n"
0180: + "<a:href rajaAttrib=\"raja.html,3,movie.html\"/>\n"
0181: + "</a:multistatus>\n\t";
0182:
0183: String lExpectation = "<a:multistatus xmlns:a=\"DAV:\">\n\t\n"
0184: + "<a:href rajaAttrib=\"http://rajanagendra.sun.com/Base/Raja/raja.html,3,http://rajanagendra.sun.com/Base/Raja/movie.html\"/>\n"
0185: + "</a:multistatus>";
0186:
0187: String[] lAttributeRules = {
0188: "<Attribute name=\"rajaAttrib\" valuePatterns=\"**,3,**html\" />", //4
0189: "<Attribute name=\"rajaAttrib\" tag=\"*\" valuePatterns=\"**,3,**html\" />", //4
0190: "<Attribute name=\"rajaAttrib\" tag=\"a:*\" valuePatterns=\"**,3,**html\" />", //4
0191: "<Attribute name=\"rajaAttrib\" tag=\"*href\" valuePatterns=\"**,3,**html\" />", //4
0192: "<Attribute name=\"rajaAttrib\" tag=\"*:href\" valuePatterns=\"**,3,**html\" />", //4
0193: "<Attribute name=\"rajaAttrib\" tag=\"a*href\" valuePatterns=\"**,3,**html\" />", //4
0194: "<Attribute name=\"rajaAttrib\" tag=\"a:*href\" valuePatterns=\"**,3,**html\" />", //4
0195: };
0196:
0197: for (int i = 0; i < lAttributeRules.length; i++) {
0198:
0199: RuleSet lRuleSet = CreateRuleSet
0200: .withXMLAttributeRules(lAttributeRules[i]);
0201: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0202: LanguageConstants.XML_MIME);
0203: String lResult = lRewriter.rewrite(lInput,
0204: getDefaultTranslator());
0205: assertXMLEqual("Failed at i=" + i, lExpectation, lResult);
0206: }//for loop
0207: }//testXMLParser()
0208:
0209: public void testAttributeWithChildPattern() throws Exception {
0210: String lInput = "<img rajaAttrib=\"raja.html,3,movie.html\"/>";
0211: String lExpectation = "<img rajaAttrib=\"http://rajanagendra.sun.com/Base/Raja/raja.html,3,http://rajanagendra.sun.com/Base/Raja/movie.html\"/>";
0212:
0213: String[] lAttributeRules = {
0214: "<Attribute name=\"rajaAttrib\" valuePatterns=\"**,3,**html\" />", //4
0215: "<Attribute name=\"rajaAttrib\" valuePatterns=\"**ja.html,3,**\" />", //3
0216: "<Attribute name=\"rajaAttrib\" valuePatterns=\"**raja.html,3,**\" />", //2
0217: "<Attribute name=\"rajaAttrib\" valuePatterns=\"*;**raja.html,3,**\" />", //1
0218: "<Attribute name=\"rajaAttrib\" valuePatterns=\"**,3,**\" />", //0
0219: };
0220:
0221: for (int i = 0; i < lAttributeRules.length; i++) {
0222: RuleSet lRuleSet = CreateRuleSet
0223: .withXMLAttributeRules(lAttributeRules[i]);
0224: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0225: LanguageConstants.XML_MIME);
0226: String lResult = lRewriter.rewrite(lInput,
0227: getDefaultTranslator());
0228: assertXMLEqual("Failed Rule: " + lAttributeRules[i],
0229: lExpectation, lResult);
0230: }//for loop
0231: }//testAttributeWithChildPattern()
0232:
0233: public void testAttributeWithChildPattern1() throws Exception {
0234: String lInput = "<img rajaAttrib=\"prefix,raja.html,3,movie.html\"/>";
0235: String lExpectation = "<img rajaAttrib=\""
0236: + "prefix,http://rajanagendra.sun.com/Base/Raja/raja.html,3,http://rajanagendra.sun.com/Base/Raja/movie.html\"/>";
0237: String[] lAttributeRules = {
0238: "<Attribute name=\"rajaAttrib\" valuePatterns=\"prefix,**,3,**html\" />", //4
0239: "<Attribute name=\"rajaAttrib\" valuePatterns=\"prefix,**ja.html,3,**\" />", //3
0240: "<Attribute name=\"rajaAttrib\" valuePatterns=\"prefix,**raja.html,3,**\" />", //2
0241: "<Attribute name=\"rajaAttrib\" valuePatterns=\"*;prefix,**raja.html,3,**\" />", //1
0242: "<Attribute name=\"rajaAttrib\" valuePatterns=\"prefix,**,3,**\" />", //0
0243: };
0244:
0245: for (int i = 0; i < lAttributeRules.length; i++) {
0246: RuleSet lRuleSet = CreateRuleSet
0247: .withXMLAttributeRules(lAttributeRules[i]);
0248: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0249: LanguageConstants.XML_MIME);
0250: String lResult = lRewriter.rewrite(lInput,
0251: getDefaultTranslator());
0252: assertXMLEqual("Failed Rule: " + lAttributeRules[i],
0253: lExpectation, lResult);
0254: }//for loop
0255: }//testAttributeWithChildPattern1()
0256:
0257: /**
0258: * Negative TestCase.. data should not be corrupted when non xml content is
0259: * passed through and also should not throw any exceptions
0260: */
0261: public void testSendNonXMLData() throws Exception {
0262: String lInput = "TestData: img rajaAttrib=\"prefix,raja.html,3,movie.html\"";
0263: String lExpectation = "TestData: img rajaAttrib=\"prefix,raja.html,3,movie.html\"";
0264:
0265: String[] lAttributeRules = {
0266: "<Attribute name=\"rajaAttrib\" valuePatterns=\"prefix,**,3,**html\" />", //4
0267: "<Attribute name=\"rajaAttrib\" valuePatterns=\"prefix,**ja.html,3,**\" />", //3
0268: "<Attribute name=\"rajaAttrib\" valuePatterns=\"prefix,**raja.html,3,**\" />", //2
0269: "<Attribute name=\"rajaAttrib\" valuePatterns=\"*;prefix,**raja.html,3,**\" />", //1
0270: "<Attribute name=\"rajaAttrib\" valuePatterns=\"prefix,**,3,**\" />", //0
0271: };
0272:
0273: for (int i = 0; i < lAttributeRules.length; i++) {
0274: RuleSet lRuleSet = CreateRuleSet
0275: .withXMLAttributeRules(lAttributeRules[i]);
0276: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0277: LanguageConstants.XML_MIME);
0278: String lResult = lRewriter.rewrite(lInput,
0279: getDefaultTranslator());
0280: assertEquals("Failed Rule: " + lAttributeRules[i],
0281: lExpectation, lResult);
0282: }//for loop
0283: }//testSendNonXMLData()
0284:
0285: public void testRuleOrder() throws Exception {
0286: String lInput = "<body>\n" + "<xml>\n"
0287: + "<baseroot href=\"/root.html\"/>\n" + "</xml>\n"
0288: + "<xml>\n" + "<img href=\"image.html\"/>\n"
0289: + "</xml>\n" + "<xml>\n"
0290: + "<string href=\"1234|substring.html\"/>\n"
0291: + "</xml>\n" + "</body>\n";
0292:
0293: String lExpectation = "<body>\n"
0294: + "<xml>\n"
0295: + "<baseroot href=\"/root.html\"/>"
0296: + "</xml>\n"
0297: + "<xml>\n"
0298: + "<img href=\"image.html\"/>"
0299: + "</xml>\n"
0300: + "<xml>\n"
0301: + "<string href=\"1234|http://rajanagendra.sun.com/Base/Raja/substring.html\"/>"
0302: + "</xml>\n" + "</body>\n";
0303:
0304: String lXMLAttRules = "<Attribute name=\"href\" valuePatterns=\"1234|\"/>"
0305: + "<Attribute name=\"href\" tag=\"img\"/>";
0306:
0307: RuleSet lRuleSet = CreateRuleSet
0308: .withXMLAttributeRules(lXMLAttRules);
0309: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0310: LanguageConstants.MARKUP_MIME);
0311: String lResult = lRewriter.rewrite(lInput,
0312: getDefaultTranslator());
0313: assertXMLEqual(lExpectation, lResult);
0314: }//testRuleOrder()
0315:
0316: public void testXMLParser3() throws Exception {
0317: String lInput = "<body>\n" + "<xml>\n"
0318: + "<baseroot href=\"/root.html\"/>\n" + "</xml>\n"
0319: + "</body>\n";
0320:
0321: String lExpectation = "<body>\n" + "<xml>\n"
0322: + "<baseroot href=\"/root.html\"/>" + "</xml>\n"
0323: + "</body>\n";
0324:
0325: String lXMLAttRules = "<Attribute name=\"href\" valuePatterns=\"1234|\"/><Attribute name=\"href\" tag=\"img\"/>";
0326:
0327: RuleSet lRuleSet = CreateRuleSet
0328: .withXMLAttributeRules(lXMLAttRules);
0329: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0330: LanguageConstants.MARKUP_MIME);
0331: String lResult = lRewriter.rewrite(lInput,
0332: getDefaultTranslator());
0333: assertXMLEqual(lExpectation, lResult);
0334: }//testXMLParser3()
0335:
0336: public void testXMLParser4() throws Exception {
0337: String lInput = "<body>\n" + "<xml>\n"
0338: + "<baseroot href=\"/root.html\"></baseroot>\n"
0339: + "</xml>\n" + "</body>\n";
0340:
0341: String lExpectation = "<body>\n" + "<xml>\n"
0342: + "<baseroot href=\"/root.html\"/>" + "</xml>\n"
0343: + "</body>\n";
0344:
0345: String lXMLAttRules = "<Attribute name=\"href\" valuePatterns=\"1234|\"/><Attribute name=\"href\" tag=\"img\"/>";
0346:
0347: RuleSet lRuleSet = CreateRuleSet
0348: .withXMLAttributeRules(lXMLAttRules);
0349: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0350: LanguageConstants.MARKUP_MIME);
0351: String lResult = lRewriter.rewrite(lInput,
0352: getDefaultTranslator());
0353: assertXMLEqual(lExpectation, lResult);
0354: }//testRuleOrder()
0355:
0356: public void testXMLParser5() throws Exception {
0357: String lInput = "<body>\n" + "<xml>\n" + "<xml>\n"
0358: + "<baseroot href=\"/root.html\"/>\n" + "</xml>\n"
0359: + "</xml>\n" + "</body>\n";
0360:
0361: String lExpectation = "<body>\n" + "<xml>\n" + "<xml>\n"
0362: + "<baseroot href=\"/root.html\"/>\n" + "</xml>\n"
0363: + "</xml>\n" + "</body>\n";
0364:
0365: String lXMLAttRules = "<Attribute name=\"href\" valuePatterns=\"1234|\"/><Attribute name=\"href\" tag=\"img\"/>";
0366:
0367: RuleSet lRuleSet = CreateRuleSet
0368: .withXMLAttributeRules(lXMLAttRules);
0369: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0370: LanguageConstants.MARKUP_MIME);
0371: String lResult = lRewriter.rewrite(lInput,
0372: getDefaultTranslator());
0373: assertXMLEqual(lExpectation, lResult);
0374: }//testXMLParser5()
0375:
0376: public void testRuleOrderVarient1() throws Exception {
0377: String lInput = "<body>\n" + "<xml>\n"
0378: + "<baseroot href=\"/root.html\"/>\n" + "</xml>\n"
0379: + "<xml>\n" + "<img href=\"image.html\"/>\n"
0380: + "</xml>\n" + "<xml>\n"
0381: + "<string href=\"1234|substring.html\"/>\n"
0382: + "</xml>\n" + "</body>\n";
0383:
0384: String lExpectation = "<body>\n"
0385: + "<xml>\n"
0386: + "<baseroot href=\"/root.html\"/>"
0387: + "</xml>\n"
0388: + "<xml>\n"
0389: + "<img href=\"http://rajanagendra.sun.com/Base/Raja/image.html\"/>"
0390: + "</xml>\n"
0391: + "<xml>\n"
0392: + "<string href=\"1234|http://rajanagendra.sun.com/Base/Raja/substring.html\"/>"
0393: + "</xml>\n" + "</body>\n";
0394:
0395: String lXMLAttRules = "<Attribute name=\"href\" tag=\"img\"/><Attribute name=\"href\" valuePatterns=\"1234|\"/>";
0396:
0397: RuleSet lRuleSet = CreateRuleSet
0398: .withXMLAttributeRules(lXMLAttRules);
0399: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0400: LanguageConstants.MARKUP_MIME);
0401: String lResult = lRewriter.rewrite(lInput,
0402: getDefaultTranslator());
0403: assertXMLEqual(lExpectation, lResult);
0404: }//testRuleOrderVarient1()
0405:
0406: public void testRuleOrderVarient2() throws Exception {
0407: String lInput = "<body>\n" + "<xml>\n"
0408: + "<baseroot href=\"/root.html\"/>\n" + "</xml>\n"
0409: + "<xml>\n" + "<img href=\"image.html\"/>" + "</xml>\n"
0410: + "<xml>\n"
0411: + "<string href=\"1234|substring.html\"/>\n"
0412: + "</xml>\n" + "</body>\n";
0413:
0414: String lExpectation = "<body>\n"
0415: + "<xml>\n<baseroot href=\"/root.html\"/></xml>\n"
0416: + "<xml>\n<img href=\"http://rajanagendra.sun.com/Base/Raja/image.html\"/></xml>\n"
0417: + "<xml>\n<string href=\"1234|http://rajanagendra.sun.com/Base/Raja/substring.html\"/></xml>\n"
0418: + "</body>\n";
0419:
0420: String lXMLAttRules = "<Attribute name=\"href\" tag=\"string\" valuePatterns=\"1234|\"/> <Attribute name=\"href\" tag=\"img\"/>";
0421:
0422: RuleSet lRuleSet = CreateRuleSet
0423: .withXMLAttributeRules(lXMLAttRules);
0424: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0425: LanguageConstants.MARKUP_MIME);
0426: String lResult = lRewriter.rewrite(lInput,
0427: getDefaultTranslator());
0428: assertXMLEqual(lExpectation, lResult);
0429: }//testRuleOrderVarient2()
0430:
0431: public void testRuleOrderVarient3() throws Exception {
0432: String lInput = "<body>\n" + "<xml>\n"
0433: + "<baseroot href=\"/root.html\"/>\n" + "</xml>\n"
0434: + "<xml>\n" + "<img href=\"image.html\"/>" + "</xml>\n"
0435: + "<xml>\n"
0436: + "<string href=\"1234|substring.html\"/>\n"
0437: + "</xml>\n" + "</body>\n";
0438:
0439: String lExpectation = "<body>\n"
0440: + "<xml>\n<baseroot href=\"http://rajanagendra.sun.com/root.html\"/></xml>\n"
0441: + "<xml>\n<img href=\"http://rajanagendra.sun.com/Base/Raja/image.html\"/></xml>\n"
0442: + "<xml>\n<string href=\"1234|http://rajanagendra.sun.com/Base/Raja/substring.html\"/></xml>\n"
0443: + "</body>\n";
0444:
0445: String lXMLAttRules = "<Attribute name=\"href\" tag=\"string\" valuePatterns=\"1234|\"/> <Attribute name=\"href\" tag=\"img\"/> <Attribute name=\"href\"/>";
0446:
0447: RuleSet lRuleSet = CreateRuleSet
0448: .withXMLAttributeRules(lXMLAttRules);
0449: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0450: LanguageConstants.MARKUP_MIME);
0451: String lResult = lRewriter.rewrite(lInput,
0452: getDefaultTranslator());
0453: assertXMLEqual(lExpectation, lResult);
0454: }//testRuleOrderVarient3()
0455:
0456: public void testRuleOrderVarient4() throws Exception {
0457: String lInput = "<body>\n" + "<xml>\n"
0458: + "<baseroot href=\"/root.html\"/>\n" + "</xml>\n"
0459: + "<xml>\n" + "<img href=\"image.html\"/>" + "</xml>\n"
0460: + "<xml>\n"
0461: + "<string href=\"1234|substring.html\"/>\n"
0462: + "</xml>\n" + "</body>\n";
0463:
0464: String lExpectation = "<body>\n"
0465: + "<xml>\n<baseroot href=\"http://rajanagendra.sun.com/root.html\"/></xml>\n"
0466: + "<xml>\n<img href=\"http://rajanagendra.sun.com/Base/Raja/image.html\"/></xml>\n"
0467: + "<xml>\n<string href=\"http://rajanagendra.sun.com/Base/Raja/1234|http://rajanagendra.sun.com/Base/Raja/substring.html\"/></xml>\n"
0468: + "</body>\n";
0469:
0470: String lXMLAttRules = "<Attribute name=\"href\" valuePatterns=\"***;1234|\"/>";
0471:
0472: RuleSet lRuleSet = CreateRuleSet
0473: .withXMLAttributeRules(lXMLAttRules);
0474: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0475: LanguageConstants.MARKUP_MIME);
0476: String lResult = lRewriter.rewrite(lInput,
0477: getDefaultTranslator());
0478: assertXMLEqual(lExpectation, lResult);
0479: }//testRuleOrderVarient4()
0480:
0481: public void testRuleOrderVarient5() throws Exception {
0482: String lInput = "<body>\n" + "<xml>\n"
0483: + "<baseroot href=\"abc|/root.html\"/>\n" + "</xml>\n"
0484: + "<xml>\n" + "<img href=\"image.html\"/>" + "</xml>\n"
0485: + "<xml>\n"
0486: + "<string href=\"1234|substring.html\"/>\n"
0487: + "</xml>\n" + "</body>\n";
0488:
0489: String lExpectation = "<body>\n"
0490: + "<xml>\n<baseroot href=\"abc|http://rajanagendra.sun.com/root.html\"/></xml>\n"
0491: + "<xml>\n<img href=\"image.html\"/></xml>\n"
0492: + "<xml>\n<string href=\"1234|http://rajanagendra.sun.com/Base/Raja/substring.html\"/></xml>\n"
0493: + "</body>\n";
0494:
0495: String lXMLAttRules = "<Attribute name=\"href\" valuePatterns=\"abc|;1234|\"/>";
0496:
0497: RuleSet lRuleSet = CreateRuleSet
0498: .withXMLAttributeRules(lXMLAttRules);
0499: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0500: LanguageConstants.MARKUP_MIME);
0501: String lResult = lRewriter.rewrite(lInput,
0502: getDefaultTranslator());
0503: assertXMLEqual(lExpectation, lResult);
0504: }//testRuleOrderVarient5()
0505:
0506: public void testRuleOrderVarient6() throws Exception {
0507: String lInput = "<body>\n" + "<xml>\n"
0508: + "<baseroot href=\"/root.html\"/>\n" + "</xml>\n"
0509: + "<xml>\n" + "<img href=\"image.html\"/>" + "</xml>\n"
0510: + "<xml>\n"
0511: + "<string href=\"1234|substring.html\"/>\n"
0512: + "</xml>\n" + "</body>\n";
0513:
0514: String lExpectation = "<body>\n"
0515: + "<xml>\n<baseroot href=\"/root.html\"/></xml>\n"
0516: + "<xml>\n<img href=\"image.html\"/></xml>\n"
0517: + "<xml>\n<string href=\"1234|http://rajanagendra.sun.com/Base/Raja/substring.html\"/></xml>\n"
0518: + "</body>\n";
0519:
0520: String lXMLAttRules = "<Attribute name=\"href\" valuePatterns=\";1234|\"/>";
0521:
0522: RuleSet lRuleSet = CreateRuleSet
0523: .withXMLAttributeRules(lXMLAttRules);
0524: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0525: LanguageConstants.MARKUP_MIME);
0526: String lResult = lRewriter.rewrite(lInput,
0527: getDefaultTranslator());
0528: assertXMLEqual(lExpectation, lResult);
0529: }//testRuleOrderVarient6()
0530:
0531: public void testOWAAttribute() throws Exception {
0532: String lInput = "<XML id=\"xmlDefaultView\">"
0533: + "<viEw xmlns:d=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882\" xmlns=\"/schemas/view\">\n"
0534: + "<baseroot>/exchweb/img/</baseroot>\n"
0535: + "<prop d:dt=\"i4\">/mapi/proptag/x0e080003</prop>\n"
0536: + "<column><heading>Subject</heading>\n"
0537: + "<prop d:dt=\"string\">/mapi/subject</prop>\n"
0538: + "<width>36%</width>\n" + "<sortable>1</sortable>\n"
0539: + "<bitmap>0</bitmap>\n"
0540: + "<multivalued>0</multivalued>\n"
0541: + "<visible>1</visible>\n"
0542: + "<style>padding-left:3px;text-align: left</style>\n"
0543: + "</column>\n" + "</viEw>\n" + "</XML>\n";
0544:
0545: String lExpectation = "<XML id=\"xmlDefaultView\">"
0546: + "<viEw xmlns:d=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882\" xmlns=\"http://rajanagendra.sun.com/schemas/view\">\n"
0547: + "<baseroot>http://rajanagendra.sun.com/exchweb/img/</baseroot>\n"
0548: + "<prop d:dt=\"i4\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0549: + "<column><heading>Subject</heading>\n"
0550: + "<prop d:dt=\"string\">/mapi/subject</prop>\n"
0551: + "<width>36%</width>\n" + "<sortable>1</sortable>\n"
0552: + "<bitmap>0</bitmap>\n"
0553: + "<multivalued>0</multivalued>\n"
0554: + "<visible>1</visible>\n"
0555: + "<style>padding-left:3px;text-align: left</style>\n"
0556: + "</column>\n" + "</viEw>" + "</XML>\n";
0557:
0558: String lXMLAttRules = "<Attribute name=\"xm*ns\" tag=\"*iE*\" />";
0559: String lXMLTagTextRules = "<TagText tag=\"basero*t\"/> <TagText tag=\"prop\" attributePatterns=\"d:dt=i4\"/>";
0560:
0561: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
0562: lXMLAttRules, lXMLTagTextRules);
0563: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0564: LanguageConstants.MARKUP_MIME);
0565: String lResult = lRewriter.rewrite(lInput,
0566: getDefaultTranslator());
0567: assertXMLEqual(lExpectation, lResult);
0568: }//testOWAAttribute()
0569:
0570: public void testOWAAttribute1() throws Exception {
0571: String lInput = "<XML id=\"xmlDefaultView\">"
0572: + "<view xmlns:d=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882\" xmlns=\"/schemas/view\">\n"
0573: + "<baseroot>/exchweb/img/</baseroot>\n"
0574: + "<prop d:dt=\"i4\">/mapi/proptag/x0e080003</prop>\n"
0575: + "<column><heading>Subject</heading>\n"
0576: + "<prop d:dt=\"string\">/mapi/subject</prop>\n"
0577: + "<width>36%</width>\n" + "<sortable>1</sortable>\n"
0578: + "<bitmap>0</bitmap>\n"
0579: + "<multivalued>0</multivalued>\n"
0580: + "<visible>1</visible>\n"
0581: + "<style>padding-left:3px;text-align: left</style>\n"
0582: + "</column>\n" + "</view>\n" + "</XML>\n";
0583:
0584: String lExpectation = "<XML id=\"xmlDefaultView\">"
0585: + "<view xmlns:d=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882\" xmlns=\"http://rajanagendra.sun.com/schemas/view\">\n"
0586: + "<baseroot>http://rajanagendra.sun.com/exchweb/img/</baseroot>\n"
0587: + "<prop d:dt=\"i4\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0588: + "<column><heading>Subject</heading>\n"
0589: + "<prop d:dt=\"string\">/mapi/subject</prop>\n"
0590: + "<width>36%</width>\n" + "<sortable>1</sortable>\n"
0591: + "<bitmap>0</bitmap>\n"
0592: + "<multivalued>0</multivalued>\n"
0593: + "<visible>1</visible>\n"
0594: + "<style>padding-left:3px;text-align: left</style>\n"
0595: + "</column>\n" + "</view>" + "</XML>\n";
0596:
0597: String lXMLAttRules = "<Attribute name=\"xm*ns\" tag=\"view\" />";
0598: String lXMLTagTextRules = "<TagText tag=\"basero*t\"/> <TagText tag=\"prop\" attributePatterns=\"d:dt=i4\"/>";
0599:
0600: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
0601: lXMLAttRules, lXMLTagTextRules);
0602: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0603: LanguageConstants.MARKUP_MIME);
0604: String lResult = lRewriter.rewrite(lInput,
0605: getDefaultTranslator());
0606: assertXMLEqual(lExpectation, lResult);
0607: }//testOWAAttribute1()
0608:
0609: public void testOWAAttributeRegExp() throws Exception {
0610: String lInput = "<XML id=\"xmlDefaultView\">"
0611: + "<view xmlns:d=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882\" xmlns=\"/schemas/view\">\n"
0612: + "<baseroot>/exchweb/img/</baseroot>\n"
0613: + "<prop d:dt=\"i4\">/mapi/proptag/x0e080003</prop>\n"
0614: + "<column><heading>Subject</heading>\n"
0615: + "<prop d:dt=\"string\">/mapi/subject</prop>\n"
0616: + "<width>36%</width>\n" + "<sortable>1</sortable>\n"
0617: + "<bitmap>0</bitmap>\n"
0618: + "<multivalued>0</multivalued>\n"
0619: + "<visible>1</visible>\n"
0620: + "<style>padding-left:3px;text-align: left</style>\n"
0621: + "</column>\n" + "</view>\n" + "</XML>\n";
0622:
0623: String lExpectation = "<XML id=\"xmlDefaultView\">"
0624: + "<view xmlns:d=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882\" xmlns=\"http://rajanagendra.sun.com/schemas/view\">\n"
0625: + "<baseroot>http://rajanagendra.sun.com/exchweb/img/</baseroot>\n"
0626: + "<prop d:dt=\"i4\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0627: + "<column><heading>Subject</heading>\n"
0628: + "<prop d:dt=\"string\">http://rajanagendra.sun.com/mapi/subject</prop>\n"
0629: + "<width>36%</width>\n" + "<sortable>1</sortable>\n"
0630: + "<bitmap>0</bitmap>\n"
0631: + "<multivalued>0</multivalued>\n"
0632: + "<visible>1</visible>\n"
0633: + "<style>padding-left:3px;text-align: left</style>\n"
0634: + "</column>\n" + "</view>" + "</XML>\n";
0635:
0636: String lXMLAttRules = "<Attribute name=\"xm*ns\" tag=\"*ie*\" />";
0637: String lXMLTagTextRules = "<TagText tag=\"basero*t\"/>"
0638: + "<TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
0639:
0640: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
0641: lXMLAttRules, lXMLTagTextRules);
0642: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0643: LanguageConstants.MARKUP_MIME);
0644: String lResult = lRewriter.rewrite(lInput,
0645: getDefaultTranslator());
0646: assertXMLEqual(lExpectation, lResult);
0647: }//testOWAAttributeRegExp()
0648:
0649: public void testOWAAttributeRegExp1() throws Exception {
0650: String lInput = "<XML id=\"xmlDefaultView\">"
0651: + "<view xmlns:d=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882\" xmlns=\"/schemas/view\">\n"
0652: + "<baseroot>/exchweb/img/</baseroot>\n"
0653: + "<prop d:dt=\"i4\">/mapi/proptag/x0e080003</prop>\n"
0654: + "<column><heading>Subject</heading>\n"
0655: + "<prop d:dt=\"string\">/mapi/subject</prop>\n"
0656: + "<width>36%</width>\n" + "<sortable>1</sortable>\n"
0657: + "<bitmap>0</bitmap>\n"
0658: + "<multivalued>0</multivalued>\n"
0659: + "<visible>1</visible>\n"
0660: + "<style>padding-left:3px;text-align: left</style>\n"
0661: + "</column>\n" + "</view>\n" + "</XML>\n";
0662:
0663: String lExpectation = "<XML id=\"xmlDefaultView\">"
0664: + "<view xmlns:d=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882\" xmlns=\"/schemas/view\">\n"
0665: + "<baseroot>http://rajanagendra.sun.com/exchweb/img/</baseroot>\n"
0666: + "<prop d:dt=\"i4\">http://rajanagendra.sun.com/mapi/proptag/x0e080003</prop>\n"
0667: + "<column><heading>Subject</heading>\n"
0668: + "<prop d:dt=\"string\">http://rajanagendra.sun.com/mapi/subject</prop>\n"
0669: + "<width>36%</width>\n" + "<sortable>1</sortable>\n"
0670: + "<bitmap>0</bitmap>\n"
0671: + "<multivalued>0</multivalued>\n"
0672: + "<visible>1</visible>\n"
0673: + "<style>padding-left:3px;text-align: left</style>\n"
0674: + "</column>\n" + "</view>" + "</XML>\n";
0675:
0676: String lXMLAttRules = "<Attribute name=\"xm*ns\" tag=\"*iE*\" />";
0677: String lXMLTagTextRules = "<TagText tag=\"basero*t\"/>"
0678: + "<TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
0679:
0680: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
0681: lXMLAttRules, lXMLTagTextRules);
0682: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0683: LanguageConstants.MARKUP_MIME);
0684: String lResult = lRewriter.rewrite(lInput,
0685: getDefaultTranslator());
0686: assertXMLEqual(lExpectation, lResult);
0687: }//testOWAAttributeRegExp1()
0688:
0689: /**
0690: * First line content is rewritten using HTML rules and rest with XML rules as we are
0691: * using Markup Rewriter.
0692: */
0693: public void testFirstLineAttribute() throws Exception {
0694: String lInput = "<XML id=\"xmlDefaultView\" xmlns:d=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882\" xmlns=\"/schemas/view\"> </XML>";
0695: String lExpectation = "<XML id=\"xmlDefaultView\" xmlns:d=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882\" xmlns=\"http://rajanagendra.sun.com/schemas/view\"> </XML>";
0696:
0697: String lHTMLAttRules = "<Attribute name=\"xm*ns\" />";
0698:
0699: RuleSet lRuleSet = CreateRuleSet
0700: .withHTMLAttributeRules(lHTMLAttRules);
0701: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0702: LanguageConstants.MARKUP_MIME);
0703: String lResult = lRewriter.rewrite(lInput,
0704: getDefaultTranslator());
0705: assertXMLEqual(lExpectation, lResult);
0706: }//testFirstLineAttribute()
0707:
0708: public void testFirstLineAttributeUSEXMLRewriter() throws Exception {
0709: String lInput = "<XML id=\"xmlDefaultView\" xmlns:d=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882\" xmlns=\"/schemas/view\"> </XML>";
0710: String lExpectation = "<XML id=\"xmlDefaultView\" xmlns:d=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882\" xmlns=\"http://rajanagendra.sun.com/schemas/view\"> </XML>";
0711:
0712: String lXMLAttRules = "<Attribute name=\"xm*ns\" />";
0713:
0714: RuleSet lRuleSet = CreateRuleSet
0715: .withXMLAttributeRules(lXMLAttRules);
0716: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0717: LanguageConstants.XML_MIME);
0718: String lResult = lRewriter.rewrite(lInput,
0719: getDefaultTranslator());
0720: assertXMLEqual(lExpectation, lResult);
0721: }//testFirstLineAttributeUSEXMLRewriter()
0722:
0723: public void testFirstLineAttributeUSEXMLRewriter1()
0724: throws Exception {
0725: //empty ending xml tag
0726: String lInput = "<XML id=\"xmlDefaultView\" xmlns:d=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882\" xmlns=\"/schemas/view\"/>";
0727: String lExpectation = "<XML id=\"xmlDefaultView\" xmlns:d=\"urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882\" xmlns=\"http://rajanagendra.sun.com/schemas/view\"/>";
0728:
0729: String lXMLAttRules = "<Attribute name=\"xm*ns\" />";
0730:
0731: RuleSet lRuleSet = CreateRuleSet
0732: .withXMLAttributeRules(lXMLAttRules);
0733: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0734: LanguageConstants.XML_MIME);
0735: String lResult = lRewriter.rewrite(lInput,
0736: getDefaultTranslator());
0737: assertXMLEqual(lExpectation, lResult);
0738: }//testFirstLineAttributeUSEXMLRewriter1()
0739:
0740: public void testBugNo4778676XMLEntities() throws Exception {
0741: String lInput = "<searchrequest xmlns=\"DAV:\">\n"
0742: + "<baseroot>/exchweb/img/</baseroot>\n"
0743: + "<sql>SELECT \"http://schemas.microsoft.com/exchange/x-priority-long\" as prop1, \"http://schemas.microso"
0744: + "ft.com/exchange/smallicon\" as prop2, \"http://schemas.microsoft.com/mapi/proptag/x10900003\" as prop3,"
0745: + "\"urn:schemas:httpmail:hasattachment\" as prop4,\"http://schemas.microsoft.com/mapi/subject\" as prop5, \""
0746: + "urn:schemas:httpmail:datereceived\" as prop6, \"http://schemas.microsoft.com/mapi/proptag/x0e080003\" as"
0747: + " prop7,\"urn:schemas:httpmail:read\" as read, \"http://schemas.microsoft.com/exchange/outlookmessageclas"
0748: + "s\" as messageclass, \"DAV:href\" as davhref FROM Scope('SHALLOW TRAVERSAL OF \"\"') WHERE \"http://schemas"
0749: + ".microsoft.com/mapi/proptag/0x67aa000b\" = false AND \"DAV:isfolder\" = false ORDER BY \"http://schemas.m"
0750: + "icrosoft.com/mapi/sent_representing_name\" ASC, \"urn:schemas:httpmail:datereceived\" DESC</sql>\n"
0751: + "<range type=\"find\" rows=\"1\">WHERE \"http://schemas.microsoft.com/mapi/sent_representing_name"
0752: + "\" >= CAST(\"System Administrator\" AS \"string\")</range>\n"
0753: + "<baseroot>/exchweb/img/</baseroot>\n"
0754: + "</searchrequest>\n";
0755:
0756: String lExpectation = "<searchrequest xmlns=\"DAV:\">\n"
0757: + "<baseroot>http://rajanagendra.sun.com/exchweb/img/</baseroot>\n"
0758: + "<sql>SELECT \"http://schemas.microsoft.com/exchange/x-priority-long\" as prop1, \"http://schemas.microso"
0759: + "ft.com/exchange/smallicon\" as prop2, \"http://schemas.microsoft.com/mapi/proptag/x10900003\" as prop3,"
0760: + "\"urn:schemas:httpmail:hasattachment\" as prop4,\"http://schemas.microsoft.com/mapi/subject\" as prop5, \""
0761: + "urn:schemas:httpmail:datereceived\" as prop6, \"http://schemas.microsoft.com/mapi/proptag/x0e080003\" as"
0762: + " prop7,\"urn:schemas:httpmail:read\" as read, \"http://schemas.microsoft.com/exchange/outlookmessageclas"
0763: + "s\" as messageclass, \"DAV:href\" as davhref FROM Scope('SHALLOW TRAVERSAL OF \"\"') WHERE \"http://schemas"
0764: + ".microsoft.com/mapi/proptag/0x67aa000b\" = false AND \"DAV:isfolder\" = false ORDER BY \"http://schemas.m"
0765: + "icrosoft.com/mapi/sent_representing_name\" ASC, \"urn:schemas:httpmail:datereceived\" DESC</sql>\n"
0766: + "<range type=\"find\" rows=\"1\">WHERE \"http://schemas.microsoft.com/mapi/sent_representing_name"
0767: + "\" >= CAST(\"System Administrator\" AS \"string\")</range>\n"
0768: + "<baseroot>http://rajanagendra.sun.com/exchweb/img/</baseroot>\n"
0769: + "</searchrequest>";
0770:
0771: String lXMLAttRules = "<Attribute name=\"te*t\" />"; //4
0772: String lXMLTagTextRules = "<TagText tag=\"bas*o*t\"/> <TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
0773:
0774: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
0775: lXMLAttRules, lXMLTagTextRules);
0776: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0777: LanguageConstants.XML_MIME);
0778: String lResult = lRewriter.rewrite(lInput,
0779: getDefaultTranslator());
0780: assertXMLEqual(lExpectation, lResult);
0781: }//testBugNo4778676XMLEntities()
0782:
0783: public void testBugNo4778676XMLEntitiesVarient() throws Exception {
0784: String lInput = "<searchrequest xmlns=\"DAV:\">\n"
0785: + "<baseroot>/exchweb/img/</baseroot>\n"
0786: + "<range type=\"find\" rows=\"1\">WHERE \"http://schemas.microsoft.com/mapi/sent_representing_name\" >= CAST(\"System Administrator\" AS \"string\")</range>\n"
0787: + "</searchrequest>";
0788:
0789: String lExpectation = "<searchrequest xmlns=\"DAV:\">\n"
0790: + "<baseroot>http://rajanagendra.sun.com/exchweb/img/</baseroot>\n"
0791: + "<range type=\"find\" rows=\"1\">WHERE \"http://schemas.microsoft.com/mapi/sent_representing_name\" >= CAST(\"System Administrator\" AS \"string\")</range>\n"
0792: + "</searchrequest>";
0793:
0794: String lXMLAttRules = "<Attribute name=\"te*t\" />"; //4
0795: String lXMLTagTextRules = "<TagText tag=\"b*t\"/>"
0796: + "<TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
0797:
0798: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
0799: lXMLAttRules, lXMLTagTextRules);
0800: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0801: LanguageConstants.XML_MIME);
0802: String lResult = lRewriter.rewrite(lInput,
0803: getDefaultTranslator());
0804: assertXMLEqual(lExpectation, lResult);
0805: }//testBugNo4778676XMLEntitiesVarient()
0806:
0807: public void testBugNo4778676XMLEntitiesVarient1() throws Exception {
0808: String lInput = "<searchrequest xmlns=\"DAV:\">\n"
0809: + "<baseroot>/exchweb/img/</baseroot>\n"
0810: + "<range type=\"find\" rows=\"1\">WHERE \"http://schemas.microsoft.com/mapi/sent_representing_name\" >=> CAST(\"System Administrator\" AS \"string\")</range>\n"
0811: + "</searchrequest>\n";
0812:
0813: String lExpectation = "<searchrequest xmlns=\"DAV:\">\n"
0814: + "<baseroot>http://rajanagendra.sun.com/exchweb/img/</baseroot>\n"
0815: + "<range type=\"find\" rows=\"1\">WHERE \"http://schemas.microsoft.com/mapi/sent_representing_name\" >=> CAST(\"System Administrator\" AS \"string\")</range>\n"
0816: + "</searchrequest>";
0817:
0818: String lXMLAttRules = "<Attribute name=\"te*t\" />"; //4
0819: String lXMLTagTextRules = "<TagText tag=\"*ero*t\"/>"
0820: + "<TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
0821:
0822: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
0823: lXMLAttRules, lXMLTagTextRules);
0824: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0825: LanguageConstants.XML_MIME);
0826: String lResult = lRewriter.rewrite(lInput,
0827: getDefaultTranslator());
0828: assertXMLEqual(lExpectation, lResult);
0829: }//testBugNo4778676XMLEntitiesVarient1()
0830:
0831: public void testBugNo4778676XMLEntitiesVarient2() throws Exception {
0832: String lInput = "<searchrequest xmlns=\"DAV:\">\n"
0833: + "<baseroot>/exchweb/img/</baseroot>\n"
0834: + "<range type=\"find\" rows=\"1\">WHERE \"http://schemas.microsoft.com/mapi/sent_representing_name\" <= CAST(\"System Administrator\" AS \"string\")</range>\n"
0835: + "</searchrequest>\n";
0836:
0837: String lExpectation = "<searchrequest xmlns=\"DAV:\">\n"
0838: + "<baseroot>http://rajanagendra.sun.com/exchweb/img/</baseroot>\n"
0839: + "<range type=\"find\" rows=\"1\">WHERE \"http://schemas.microsoft.com/mapi/sent_representing_name\" <= CAST(\"System Administrator\" AS \"string\")</range>\n"
0840: + "</searchrequest>";
0841:
0842: String lXMLAttRules = "<Attribute name=\"te*t\" />"; //4
0843: String lXMLTagTextRules = "<TagText tag=\"base*o*t\"/>"
0844: + "<TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
0845:
0846: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
0847: lXMLAttRules, lXMLTagTextRules);
0848: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0849: LanguageConstants.XML_MIME);
0850: String lResult = lRewriter.rewrite(lInput,
0851: getDefaultTranslator());
0852: assertXMLEqual(lExpectation, lResult);
0853:
0854: }//testBugNo4778676XMLEntitiesVarient2()
0855:
0856: public void testBugNo4778676XMLEntitiesVarient3() throws Exception {
0857: String lInput = "<searchrequest xmlns=\"DAV:\">\n"
0858: + "<baseroot>/exchweb/img/</baseroot>\n"
0859: + "<range type=\"find\" rows=\"1\"> >WHERE \"http://schemas.microsoft.com/mapi/sent_representing_name\" ><= CAST(\"System Administrator\" > AS \"string\")</range>\n"
0860: + "</searchrequest>\n";
0861:
0862: String lExpectation = "<searchrequest xmlns=\"DAV:\">\n"
0863: + "<baseroot>http://rajanagendra.sun.com/exchweb/img/</baseroot>\n"
0864: + "<range type=\"find\" rows=\"1\"> >WHERE \"http://schemas.microsoft.com/mapi/sent_representing_name\" ><= CAST(\"System Administrator\" > AS \"string\")</range>\n"
0865: + "</searchrequest>";
0866:
0867: String lXMLAttRules = "<Attribute name=\"te*t\" />"; //4
0868: String lXMLTagTextRules = "<TagText tag=\"b*sero*t\"/>"
0869: + "<TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
0870:
0871: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
0872: lXMLAttRules, lXMLTagTextRules);
0873: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0874: LanguageConstants.XML_MIME);
0875: String lResult = lRewriter.rewrite(lInput,
0876: getDefaultTranslator());
0877: assertXMLEqual(lExpectation, lResult);
0878: }//testBugNo4778676XMLEntitiesVarient3()
0879:
0880: public void testBugNo4778676XMLEntitiesVarient4() throws Exception {
0881: String lInput = "<searchrequest xmlns=\"DAV:\">\n"
0882: + "<baseroot>/exchweb/img/</baseroot>\n"
0883: + "<range type=\"find\" rows=\"1\"> abc>WHERE \"http://schemas.microsoft.com/mapi/sent_representing_name\" ><= CAST(\"System Administrator\" > AS \"string\")</range>\n"
0884: + "</searchrequest>\n";
0885:
0886: String lExpectation = "<searchrequest xmlns=\"DAV:\">\n"
0887: + "<baseroot>http://rajanagendra.sun.com/exchweb/img/</baseroot>\n"
0888: + "<range type=\"find\" rows=\"1\"> abc>WHERE \"http://schemas.microsoft.com/mapi/sent_representing_name\" ><= CAST(\"System Administrator\" > AS \"string\")</range>\n"
0889: + "</searchrequest>";
0890:
0891: String lXMLAttRules = "<Attribute name=\"te*t\" />"; //4
0892: String lXMLTagTextRules = "<TagText tag=\"bas*ero*t\"/>"
0893: + "<TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
0894:
0895: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
0896: lXMLAttRules, lXMLTagTextRules);
0897: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0898: LanguageConstants.XML_MIME);
0899: String lResult = lRewriter.rewrite(lInput,
0900: getDefaultTranslator());
0901: assertXMLEqual(lExpectation, lResult);
0902: }//testBugNo4778676XMLEntitiesVarient4()
0903:
0904: public void testBug4780974CorruptingSPAN() throws Exception {
0905: String lInput = "<?xml version=\"1.0\"?>\n"
0906: + "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" xmlns:d=\"urn:schemas:httpmail:\" xmlns:g=\"http://schemas.microsoft.com/exchange/\" xmlns:f=\"urn:schemas-microsoft-com:office:office\" xmlns:a=\"DAV:\" default-space=\"strip\">\n"
0907: + "<xsl:template match=\"/\">\n"
0908: + "<xsl:for-each select=\"a:multistatus/a:response\" xmlns:a=\"DAV:\">\n"
0909: + "<DIV id=\"nodeContainer\" nowrap=\"true\" style=\"padding-left:2px;\" onclick=\"if(null == event.returnValue)even"
0910: + "t.returnValue=this;\">\n"
0911: + "<SPAN id=\"MSOWA_unreadcount\" style=\"color:blue\">(<xsl:value-of select=\"d:unreadcount\" />)</SPAN>\n"
0912: + "</DIV>\n" + "</xsl:for-each>\n"
0913: + "</xsl:template>\n" + "</xsl:stylesheet>\n";
0914:
0915: String lExpectation = "<?xml version=\"1.0\"?>\n"
0916: + "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" xmlns:d=\"urn:schemas:httpmail:\" xmlns:g=\"http://schemas.microsoft.com/exchange/\" xmlns:f=\"urn:schemas-microsoft-com:office:office\" xmlns:a=\"DAV:\" default-space=\"strip\">\n"
0917: + "<xsl:template match=\"/\">\n"
0918: + "<xsl:for-each select=\"a:multistatus/a:response\" xmlns:a=\"DAV:\">\n"
0919: + "<DIV id=\"nodeContainer\" nowrap=\"true\" style=\"padding-left:2px;\" onclick=\"if(null == event.returnValue)event.returnValue=this;\">\n"
0920: + "<SPAN id=\"MSOWA_unreadcount\" style=\"color:blue\">(<xsl:value-of select=\"d:unreadcount\"/>)</SPAN>\n"
0921: + "</DIV>\n" + "</xsl:for-each>\n"
0922: + "</xsl:template>\n" + "</xsl:stylesheet>";
0923:
0924: String lXMLAttRules = "<Attribute name=\"te*t\" />"; //4
0925: String lXMLTagTextRules = "<TagText tag=\"bas*ero*t\"/>"
0926: + "<TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
0927:
0928: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
0929: lXMLAttRules, lXMLTagTextRules);
0930: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0931: LanguageConstants.XML_MIME);
0932: String lResult = lRewriter.rewrite(lInput,
0933: getDefaultTranslator());
0934: assertXMLEqual(lExpectation, lResult);
0935: }//testBug4780974CorruptingSPAN()
0936:
0937: public void testBug4780974CorruptingSPANVarient() throws Exception {
0938: String lInput = "<?xml version=\"1.0\"?>\n"
0939: + "<SPAN>(<xsl:value-of select=\"d:unreadcount\" />)</SPAN>\n";
0940:
0941: String lExpectation = "<?xml version=\"1.0\"?>\n"
0942: + "<SPAN>(<xsl:value-of select=\"d:unreadcount\" />)</SPAN>\n";
0943:
0944: String lXMLAttRules = "<Attribute name=\"te*t\" />"; //4
0945: String lXMLTagTextRules = "<TagText tag=\"bas*ero*t\"/> "
0946: + "<TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
0947:
0948: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
0949: lXMLAttRules, lXMLTagTextRules);
0950: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0951: LanguageConstants.XML_MIME);
0952: String lResult = lRewriter.rewrite(lInput,
0953: getDefaultTranslator());
0954: assertEquals(lExpectation, lResult);
0955: }//testBug4780974CorruptingSPANVarient()
0956:
0957: public void testBug4780974CorruptingSPANVarient1() throws Exception {
0958: String lInput = "<?xml version=\"1.0\"?>\n"
0959: + "<SPAN>unreadcount</SPAN>\n";
0960:
0961: String lExpectation = "<?xml version=\"1.0\"?>\n"
0962: + "<SPAN>unreadcount</SPAN>";
0963:
0964: String lXMLAttRules = "<Attribute name=\"te*t\" />"; //4
0965: String lXMLTagTextRules = "<TagText tag=\"bas*ero*t\"/>"
0966: + "<TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
0967:
0968: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
0969: lXMLAttRules, lXMLTagTextRules);
0970: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0971: LanguageConstants.XML_MIME);
0972: String lResult = lRewriter.rewrite(lInput,
0973: getDefaultTranslator());
0974: assertXMLEqual(lExpectation, lResult);
0975: }//testBug4780974CorruptingSPANVarient1()
0976:
0977: public void testBug4780974CorruptingSPANVarient2() throws Exception {
0978: String lInput = "<?xml version=\"1.0\"?>\n"
0979: + "<SPAN>(unreadcount)</SPAN>\n";
0980:
0981: String lExpectation = "<?xml version=\"1.0\"?>\n"
0982: + "<SPAN>(unreadcount)</SPAN>";
0983:
0984: String lXMLAttRules = "<Attribute name=\"te*t\" />"; //4
0985: String lXMLTagTextRules = "<TagText tag=\"bas*ero*t\"/>"
0986: + "<TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
0987:
0988: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
0989: lXMLAttRules, lXMLTagTextRules);
0990: Rewriter lRewriter = RewriterPool.create(lRuleSet,
0991: LanguageConstants.XML_MIME);
0992: String lResult = lRewriter.rewrite(lInput,
0993: getDefaultTranslator());
0994: assertXMLEqual(lExpectation, lResult);
0995: }//testBug4780974CorruptingSPANVarient2()
0996:
0997: public void testBug4780974CorruptingSPANVarient3() throws Exception {
0998: String lInput = "<?xml version=\"1.0\"?>\n"
0999: + "<xsl xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">\n"
1000: + "<SPAN>(<xsl:value-of select=\"d:unreadcount\" />)</SPAN>\n"
1001: + "</xsl>\n";
1002:
1003: String lExpectation = "<?xml version=\"1.0\"?>\n"
1004: + "<xsl xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">\n"
1005: + "<SPAN>(<xsl:value-of select=\"d:unreadcount\"/>)</SPAN>\n"
1006: + "</xsl>";
1007:
1008: String lXMLAttRules = "<Attribute name=\"te*t\" />"; //4
1009: String lXMLTagTextRules = "<TagText tag=\"bas*ero*t\"/> <TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
1010:
1011: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
1012: lXMLAttRules, lXMLTagTextRules);
1013: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1014: LanguageConstants.XML_MIME);
1015: String lResult = lRewriter.rewrite(lInput,
1016: getDefaultTranslator());
1017: assertXMLEqual(lExpectation, lResult);
1018: }//testBug4780974CorruptingSPANVarient3()
1019:
1020: public void testBug4780974CorruptingSPANVarient4() throws Exception {
1021: String lInput = "<?xml version=\"1.0\"?>\n"
1022: + "<xsl xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">\n"
1023: + "<SPAN>(<xsl:value-of select=\"d:unreadcount\" />)</SPAN>\n"
1024: + "</xsl>\n";
1025:
1026: String lExpectation = "<?xml version=\"1.0\"?>\n"
1027: + "<xsl xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">\n"
1028: + "<SPAN>(<xsl:value-of select=\"d:unreadcount\" />)</SPAN>\n"
1029: + "</xsl>";
1030:
1031: String lXMLAttRules = "<Attribute name=\"te*t\" />"; //4
1032: String lXMLTagTextRules = "<TagText tag=\"bas*ero*t\"/> <TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
1033:
1034: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
1035: lXMLAttRules, lXMLTagTextRules);
1036: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1037: LanguageConstants.XML_MIME);
1038: String lResult = lRewriter.rewrite(lInput,
1039: getDefaultTranslator());
1040: assertXMLEqual(lExpectation, lResult);
1041: }//testBug4780974CorruptingSPANVarient4()
1042:
1043: public void testBug4780974CorruptingSPANVarient5() throws Exception {
1044: String lInput = "<?xml version=\"1.0\"?>\n"
1045: + "<xsl xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">\n"
1046: + "<SPAN><xsl:value-of select=\"d:unreadcount\" /></SPAN>\n"
1047: + "</xsl>\n";
1048:
1049: String lExpectation = "<?xml version=\"1.0\"?>\n"
1050: + "<xsl xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">\n"
1051: + "<SPAN><xsl:value-of select=\"d:unreadcount\"/></SPAN>\n"
1052: + "</xsl>";
1053:
1054: String lXMLAttRules = "<Attribute name=\"te*t\" />"; //4
1055: String lXMLTagTextRules = "<TagText tag=\"bas*ero*t\"/> <TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
1056:
1057: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
1058: lXMLAttRules, lXMLTagTextRules);
1059: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1060: LanguageConstants.XML_MIME);
1061: String lResult = lRewriter.rewrite(lInput,
1062: getDefaultTranslator());
1063: assertXMLEqual(lExpectation, lResult);
1064: }//testBug4780974CorruptingSPANVarient5()
1065:
1066: public void testBug4780974CorruptingSPANVarient6() throws Exception {
1067: String lInput = "<?xml version=\"1.0\"?>\n"
1068: + "<xsl xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">\n"
1069: + "<SPAN>" + "("
1070: + "<xsl:value-of select=\"d:unreadcount\" />" + ")"
1071: + "</SPAN>\n" + "</xsl>\n";
1072:
1073: String lExpectation = "<?xml version=\"1.0\"?>\n"
1074: + "<xsl xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">\n"
1075: + "<SPAN>(<xsl:value-of select=\"d:unreadcount\"/>)</SPAN>\n"
1076: + "</xsl>";
1077:
1078: String lXMLAttRules = "<Attribute name=\"te*t\" />"; //4
1079: String lXMLTagTextRules = "<TagText tag=\"bas*ero*t\"/> <TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
1080:
1081: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
1082: lXMLAttRules, lXMLTagTextRules);
1083: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1084: LanguageConstants.XML_MIME);
1085: String lResult = lRewriter.rewrite(lInput,
1086: getDefaultTranslator());
1087: assertXMLEqual(lExpectation, lResult);
1088: }//testBug4780974CorruptingSPANVarient6()
1089:
1090: public void testBug4780974CorruptingSPANVarient7() throws Exception {
1091: String lInput = "<?xml version=\"1.0\"?>\n"
1092: + "<xsl xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">\n"
1093: + "<SPAN>" + "(" + "<a select=\"d:unreadcount\" />"
1094: + ")" + "</SPAN>\n" + "</xsl>\n";
1095:
1096: String lExpectation = "<?xml version=\"1.0\"?>\n"
1097: + "<xsl xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">\n"
1098: + "<SPAN>(<a select=\"d:unreadcount\"/>)</SPAN>\n"
1099: + "</xsl>";
1100:
1101: String lXMLAttRules = "<Attribute name=\"te*t\" />"; //4
1102: String lXMLTagTextRules = "<TagText tag=\"bas*ero*t\"/> <TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
1103:
1104: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
1105: lXMLAttRules, lXMLTagTextRules);
1106: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1107: LanguageConstants.XML_MIME);
1108: String lResult = lRewriter.rewrite(lInput,
1109: getDefaultTranslator());
1110: assertXMLEqual(lExpectation, lResult);
1111: }//testBug4780974CorruptingSPANVarient7()
1112:
1113: public void testBug4780974CorruptingSPANVarient71()
1114: throws Exception {
1115: String lInput = "<?xml version=\"1.0\"?>"
1116: + "<xsl xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">"
1117: + "<SPAN>(<a select=\"d:unreadcount\"/>\n)</SPAN>\n"
1118: + "<SPAN>(<a select=\"d:unreadcount\"/>)</SPAN>\n"
1119: + "<SPAN>(<a select=\"d:unreadcount\"/>)\n</SPAN>\n"
1120: + "</xsl>\n";
1121:
1122: String lExpectation = "<?xml version=\"1.0\"?>"
1123: + "<xsl xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">"
1124: + "<SPAN>(<a select=\"d:unreadcount\"/>\n)</SPAN>\n"
1125: + "<SPAN>(<a select=\"d:unreadcount\"/>)</SPAN>\n"
1126: + "<SPAN>(<a select=\"d:unreadcount\"/>)\n</SPAN>\n"
1127: + "</xsl>";
1128:
1129: String lXMLAttRules = "<Attribute name=\"te*t\" />"; //4
1130: String lXMLTagTextRules = "<TagText tag=\"bas*ero*t\"/> "
1131: + "<TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
1132:
1133: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
1134: lXMLAttRules, lXMLTagTextRules);
1135: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1136: LanguageConstants.XML_MIME);
1137: String lResult = lRewriter.rewrite(lInput,
1138: getDefaultTranslator());
1139: assertXMLEqual(lExpectation, lResult);
1140: }//testBug4780974CorruptingSPANVarient71()
1141:
1142: public void testBug4780974CorruptingSPANVarient8() throws Exception {
1143: String lInput = "<?xml version=\"1.0\"?>\n"
1144: + "<xsl xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">\n"
1145: + "<SPAN>(</SPAN><a select=\"d:unreadcount\" /><SPAN>)"
1146: + "</SPAN>\n\n\t" + "</xsl>\n";
1147:
1148: String lExpectation = "<?xml version=\"1.0\"?>\n"
1149: + "<xsl xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">\n"
1150: + "<SPAN>(</SPAN><a select=\"d:unreadcount\"/><SPAN>)"
1151: + "</SPAN>\n\n\t" + "</xsl>";
1152:
1153: String lXMLAttRules = "<Attribute name=\"te*t\" />"; //4
1154: String lXMLTagTextRules = "<TagText tag=\"bas*ero*t\"/> <TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
1155:
1156: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
1157: lXMLAttRules, lXMLTagTextRules);
1158: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1159: LanguageConstants.XML_MIME);
1160: String lResult = lRewriter.rewrite(lInput,
1161: getDefaultTranslator());
1162: assertXMLEqual(lExpectation, lResult);
1163: }//testBug4780974CorruptingSPANVarient8()
1164:
1165: public void testBugNo4788050XSLRewritting() throws Exception {
1166: String lInput = "<?xml version='1.0'?>\n"
1167: + "<!-- abcdef -->"
1168: + //XML comment
1169: "<xsl:stylesheet\n"
1170: + " xmlns:xsl=\"/Transform\" xmlns:a=\"DAV:\" version='1.0'>\n"
1171: + "<xsl:output method=\"html\"/>\n" + "\n"
1172: + "<xsl:template match=\"document\">\n"
1173: + " <HTML><HEAD><TITLE> \n"
1174: + " <xsl:value-of select=\"./title\"/>\n"
1175: + " </TITLE>\n" + " </HEAD>\n" + " <BODY>\n"
1176: + "<a:href rajaAttrib=\"raja.html,3,movie.html\"/>\n"
1177: + "<a:href raja=\"raja.html\"/>\n"
1178: + " <xsl:apply-templates/>\n" + " </BODY>\n"
1179: + " </HTML>\n" + "</xsl:template>\n" + "\n"
1180: + "<xsl:template match=\"title\">\n"
1181: + " <H1><xsl:apply-templates/></H1>\n"
1182: + "</xsl:template>\n" + "\n"
1183: + "<xsl:template match=\"para\">\n"
1184: + " <P><xsl:apply-templates/></P>\n"
1185: + "<a:href rajaAttrib=\"raja.html,3,movie.html\"/>\n"
1186: + "<a:href raja=\"raja.html\"/>\n"
1187: + "</xsl:template>\n" + "\n" + "</xsl:stylesheet>\n";
1188:
1189: String lExpectation = "<?xml version='1.0'?>\n"
1190: + "<!-- abcdef -->"
1191: + //XML comment
1192: "<xsl:stylesheet xmlns:xsl=\"http://rajanagendra.sun.com/Transform\" xmlns:a=\"DAV:\" version=\"1.0\">\n"
1193: + "<xsl:output method=\"html\"/>\n"
1194: + "\n"
1195: + "<xsl:template match=\"document\">\n"
1196: + " <HTML><HEAD><TITLE> \n"
1197: + " <xsl:value-of select=\"./title\"/>\n"
1198: + " </TITLE>\n"
1199: + " </HEAD>\n"
1200: + " <BODY>\n"
1201: + "<a:href rajaAttrib=\"http://rajanagendra.sun.com/Base/Raja/raja.html,3,http://rajanagendra.sun.com/Base/Raja/movie.html\"/>\n"
1202: + "<a:href raja=\"http://rajanagendra.sun.com/Base/Raja/raja.html\"/>\n"
1203: + " <xsl:apply-templates/>\n"
1204: + " </BODY>\n"
1205: + " </HTML>\n"
1206: + "</xsl:template>\n"
1207: + "\n"
1208: + "<xsl:template match=\"title\">\n"
1209: + " <H1><xsl:apply-templates/></H1>\n"
1210: + "</xsl:template>\n"
1211: + "\n"
1212: + "<xsl:template match=\"para\">\n"
1213: + " <P><xsl:apply-templates/></P>\n"
1214: + "<a:href rajaAttrib=\"http://rajanagendra.sun.com/Base/Raja/raja.html,3,http://rajanagendra.sun.com/Base/Raja/movie.html\"/>\n"
1215: + "<a:href raja=\"http://rajanagendra.sun.com/Base/Raja/raja.html\"/>\n"
1216: + "</xsl:template>\n" + "\n" + "</xsl:stylesheet>";
1217:
1218: String lXMLAttRules = "<Attribute name=\"xmlns:xsl\" tag=\"xsl:styleshee*\"/>"
1219: + "<Attribute name=\"rajaAttrib\" tag=\"a:*href\" valuePatterns=\"**,3,**html\" />"
1220: + "<Attribute name=\"raja\" tag=\"a:*href\"/>";
1221:
1222: String lXMLTagTextRules = "<TagText tag=\"bas*ero*t\"/>"
1223: + "<TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
1224:
1225: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
1226: lXMLAttRules, lXMLTagTextRules);
1227: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1228: LanguageConstants.XML_MIME);
1229: String lResult = lRewriter.rewrite(lInput,
1230: getDefaultTranslator());
1231: assertXMLEqual(lExpectation, lResult);
1232: }//testBugNo4788050XSLRewritting()
1233:
1234: public void testBugNo4788050XSLRewrittingMultiLineComment()
1235: throws Exception {
1236: String lInput = "<?xml version='1.0'?>\n"
1237: + "<!-- "
1238: + "abcdef "
1239: + "ewwewewe kuoirewu iuoi uwreoi"
1240: + "-->"
1241: + //XML comment
1242: "<xsl:stylesheet\n"
1243: + " xmlns:xsl=\"/Transform\" xmlns:a=\"DAV:\" version='1.0'>\n"
1244: + "<xsl:output method=\"html\"/>\n" + "\n"
1245: + "<xsl:template match=\"document\">\n"
1246: + " <HTML><HEAD><TITLE> \n"
1247: + " <xsl:value-of select=\"./title\"/>\n"
1248: + " </TITLE>\n" + " </HEAD>\n" + " <BODY>\n"
1249: + "<a:href rajaAttrib=\"raja.html,3,movie.html\"/>\n"
1250: + "<a:href raja=\"raja.html\"/>\n"
1251: + " <xsl:apply-templates/>\n" + " </BODY>\n"
1252: + " </HTML>\n" + "</xsl:template>\n" + "\n"
1253: + "<xsl:template match=\"title\">\n"
1254: + " <H1><xsl:apply-templates/></H1>\n"
1255: + "</xsl:template>\n" + "\n"
1256: + "<xsl:template match=\"para\">\n"
1257: + " <P><xsl:apply-templates/></P>\n"
1258: + "<a:href rajaAttrib=\"raja.html,3,movie.html\"/>\n"
1259: + "<a:href raja=\"raja.html\"/>\n"
1260: + "</xsl:template>\n" + "\n" + "</xsl:stylesheet>\n";
1261:
1262: String lExpectation = "<?xml version='1.0'?>\n"
1263: + "<!-- "
1264: + "abcdef "
1265: + "ewwewewe kuoirewu iuoi uwreoi"
1266: + "-->"
1267: + "<xsl:stylesheet xmlns:xsl=\"http://rajanagendra.sun.com/Transform\" xmlns:a=\"DAV:\" version=\"1.0\">\n"
1268: + "<xsl:output method=\"html\"/>\n"
1269: + "\n"
1270: + "<xsl:template match=\"document\">\n"
1271: + " <HTML><HEAD><TITLE> \n"
1272: + " <xsl:value-of select=\"./title\"/>\n"
1273: + " </TITLE>\n"
1274: + " </HEAD>\n"
1275: + " <BODY>\n"
1276: + "<a:href rajaAttrib=\"http://rajanagendra.sun.com/Base/Raja/raja.html,3,http://rajanagendra.sun.com/Base/Raja/movie.html\"/>\n"
1277: + "<a:href raja=\"http://rajanagendra.sun.com/Base/Raja/raja.html\"/>\n"
1278: + " <xsl:apply-templates/>\n"
1279: + " </BODY>\n"
1280: + " </HTML>\n"
1281: + "</xsl:template>\n"
1282: + "\n"
1283: + "<xsl:template match=\"title\">\n"
1284: + " <H1><xsl:apply-templates/></H1>\n"
1285: + "</xsl:template>\n"
1286: + "\n"
1287: + "<xsl:template match=\"para\">\n"
1288: + " <P><xsl:apply-templates/></P>\n"
1289: + "<a:href rajaAttrib=\"http://rajanagendra.sun.com/Base/Raja/raja.html,3,http://rajanagendra.sun.com/Base/Raja/movie.html\"/>\n"
1290: + "<a:href raja=\"http://rajanagendra.sun.com/Base/Raja/raja.html\"/>\n"
1291: + "</xsl:template>\n" + "\n" + "</xsl:stylesheet>";
1292:
1293: String lXMLAttRules = "<Attribute name=\"xmlns:xsl\" tag=\"xsl:styleshee*\"/>"
1294: + "<Attribute name=\"rajaAttrib\" tag=\"a:*href\" valuePatterns=\"**,3,**html\" />"
1295: + "<Attribute name=\"raja\" tag=\"a:*href\"/>";
1296:
1297: String lXMLTagTextRules = "<TagText tag=\"bas*ero*t\"/>"
1298: + "<TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
1299:
1300: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
1301: lXMLAttRules, lXMLTagTextRules);
1302: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1303: LanguageConstants.XML_MIME);
1304: String lResult = lRewriter.rewrite(lInput,
1305: getDefaultTranslator());
1306: assertXMLEqual(lExpectation, lResult);
1307: }//testBugNo4788050XSLRewrittingMultiLineComment()
1308:
1309: public void testBugNo4788050XSLWithCommentBeforeRootElement()
1310: throws Exception {
1311: String lInput = "<?xml version='1.0'?>\n"
1312: + "<!-- abc xyz \n this is a comment-->"
1313: + "<xsl:stylesheet\n"
1314: + " xmlns:xsl=\"/Transform\" xmlns:a=\"DAV:\" version='1.0'>\n"
1315: + "<xsl:output method=\"html\"/>\n" + "\n"
1316: + "<xsl:template match=\"document\">\n"
1317: + " <HTML><HEAD><TITLE> \n"
1318: + " <xsl:value-of select=\"./title\"/>\n"
1319: + " </TITLE>\n" + " </HEAD>\n" + " <BODY>\n"
1320: + "<a:href rajaAttrib=\"raja.html,3,movie.html\"/>\n"
1321: + "<a:href raja=\"raja.html\"/>\n"
1322: + " <xsl:apply-templates/>\n" + " </BODY>\n"
1323: + " </HTML>\n" + "</xsl:template>\n" + "\n"
1324: + "<xsl:template match=\"title\">\n"
1325: + " <H1><xsl:apply-templates/></H1>\n"
1326: + "</xsl:template>\n" + "\n"
1327: + "<xsl:template match=\"para\">\n"
1328: + " <P><xsl:apply-templates/></P>\n"
1329: + "<a:href rajaAttrib=\"raja.html,3,movie.html\"/>\n"
1330: + "<a:href raja=\"raja.html\"/>\n"
1331: + "</xsl:template>\n" + "\n" + "</xsl:stylesheet>\n";
1332:
1333: String lExpectation = "<?xml version='1.0'?>\n"
1334: + "<!-- abc xyz \n this is a comment-->"
1335: + "<xsl:stylesheet xmlns:xsl=\"http://rajanagendra.sun.com/Transform\" xmlns:a=\"DAV:\" version=\"1.0\">\n"
1336: + "<xsl:output method=\"html\"/>\n"
1337: + "\n"
1338: + "<xsl:template match=\"document\">\n"
1339: + " <HTML><HEAD><TITLE> \n"
1340: + " <xsl:value-of select=\"./title\"/>\n"
1341: + " </TITLE>\n"
1342: + " </HEAD>\n"
1343: + " <BODY>\n"
1344: + "<a:href rajaAttrib=\"http://rajanagendra.sun.com/Base/Raja/raja.html,3,http://rajanagendra.sun.com/Base/Raja/movie.html\"/>\n"
1345: + "<a:href raja=\"http://rajanagendra.sun.com/Base/Raja/raja.html\"/>\n"
1346: + " <xsl:apply-templates/>\n"
1347: + " </BODY>\n"
1348: + " </HTML>\n"
1349: + "</xsl:template>\n"
1350: + "\n"
1351: + "<xsl:template match=\"title\">\n"
1352: + " <H1><xsl:apply-templates/></H1>\n"
1353: + "</xsl:template>\n"
1354: + "\n"
1355: + "<xsl:template match=\"para\">\n"
1356: + " <P><xsl:apply-templates/></P>\n"
1357: + "<a:href rajaAttrib=\"http://rajanagendra.sun.com/Base/Raja/raja.html,3,http://rajanagendra.sun.com/Base/Raja/movie.html\"/>\n"
1358: + "<a:href raja=\"http://rajanagendra.sun.com/Base/Raja/raja.html\"/>\n"
1359: + "</xsl:template>\n" + "\n" + "</xsl:stylesheet>";
1360:
1361: String lXMLAttRules = "<Attribute name=\"xmlns:xsl\" tag=\"xsl:styleshee*\"/>"
1362: + "<Attribute name=\"rajaAttrib\" tag=\"a:*href\" valuePatterns=\"**,3,**html\" />"
1363: + "<Attribute name=\"raja\" tag=\"a:*href\"/>";
1364:
1365: String lXMLTagTextRules = "<TagText tag=\"bas*ero*t\"/> "
1366: + "<TagText tag=\"prop\" attributePatterns=\"d:dt=*\"/>";
1367:
1368: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
1369: lXMLAttRules, lXMLTagTextRules);
1370: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1371: LanguageConstants.XML_MIME);
1372: String lResult = lRewriter.rewrite(lInput,
1373: getDefaultTranslator());
1374: assertXMLEqual(lExpectation, lResult);
1375: }//testBugNo4788050XSLWithCommentBeforeRootElement()
1376:
1377: public void testCaseSensitivityInAttribRules() throws Exception {
1378: String lInput = "<IMG xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" id=\"folderIcon\" width=\"16\" height=\"16\" border=\"0\" style=\"cursor:hand\">\n"
1379: + "<xsl:choose href=\"abc.html\"></xsl:choose>\n"
1380: + "<icon path=\"/iconDraw.gif\"></icon>\n"
1381: + "<attribute name=\"src\" value=\"/iconDraw.gif\"></attribute>\n"
1382: + "</IMG>\n";
1383:
1384: String lExpectation = "<IMG xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" id=\"folderIcon\" width=\"16\" height=\"16\" border=\"0\" style=\"cursor:hand\">\n"
1385: + "<xsl:choose href=\"http://rajanagendra.sun.com/Base/Raja/abc.html\"/>\n"
1386: + "<icon path=\"http://rajanagendra.sun.com/iconDraw.gif\"/>\n"
1387: + "<attribute name=\"src\" value=\"http://rajanagendra.sun.com/iconDraw.gif\"/>\n"
1388: + "</IMG>";
1389:
1390: String[] lXMLAttributeRules = {
1391: "<Attribute name=\"href\" tag=\"xsl:choose\"/>"
1392: + "<Attribute name=\"path\" tag=\"icon\"/>"
1393: + "<Attribute name=\"value\" tag=\"attribute\"/>",
1394: "<Attribute name=\"href\" tag=\"*:choose\"/>"
1395: + "<Attribute name=\"path\" tag=\"icon\"/>"
1396: + "<Attribute name=\"value\" tag=\"attribute\"/>",
1397: "<Attribute name=\"href\" tag=\"*choose\"/>"
1398: + "<Attribute name=\"path\" tag=\"icon\"/>"
1399: + "<Attribute name=\"value\" tag=\"attribute\"/>",
1400: "<Attribute name=\"href*\" tag=\"xsl:choose\"/>"
1401: + "<Attribute name=\"path\" tag=\"icon\"/>"
1402: + "<Attribute name=\"value\" tag=\"attribute\"/>",
1403: "<Attribute name=\"*href*\" tag=\"xsl:choose\"/>"
1404: + "<Attribute name=\"path\" tag=\"icon\"/>"
1405: + "<Attribute name=\"value\" tag=\"attribute\"/>",
1406: "<Attribute name=\"h*ef\" tag=\"xsl:choose\"/>"
1407: + "<Attribute name=\"pa*h\" tag=\"ic*n\"/>"
1408: + "<Attribute name=\"val*e\" tag=\"att*ribute\"/>", };
1409:
1410: for (int i = 0; i < lXMLAttributeRules.length; i++) {
1411: RuleSet lRuleSet = CreateRuleSet
1412: .withXMLAttributeRules(lXMLAttributeRules[i]);
1413:
1414: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1415: LanguageConstants.XML_MIME);
1416: String lResult = lRewriter.rewrite(lInput,
1417: getDefaultTranslator());
1418: assertXMLEqual("i=" + i, lExpectation, lResult);
1419: }
1420: }//testCaseSensitivityInAttribRules()
1421:
1422: public void testCaseSensitivityInAttribRulesVarient()
1423: throws Exception {
1424: String lInput = "<IMG xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" id=\"folderIcon\" width=\"16\" height=\"16\" border=\"0\" style=\"cursor:hand\">\n"
1425: + "<xsl:choose href=\"abc.html\"></xsl:choose>\n"
1426: + "<icon path=\"/iconDraw.gif\"></icon>\n"
1427: + "<Icon path=\"/iconDraw.gif\"></Icon>\n"
1428: + "<attribute name=\"src\" value=\"/iconDraw.gif\"></attribute>\n"
1429: + "</IMG>\n";
1430:
1431: String lExpectation = "<IMG xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" id=\"folderIcon\" width=\"16\" height=\"16\" border=\"0\" style=\"cursor:hand\">\n"
1432: + "<xsl:choose href=\"http://rajanagendra.sun.com/Base/Raja/abc.html\"/>\n"
1433: + "<icon path=\"http://rajanagendra.sun.com/iconDraw.gif\"/>\n"
1434: + "<Icon path=\"http://rajanagendra.sun.com/iconDraw.gif\"/>\n"
1435: + "<attribute name=\"src\" value=\"http://rajanagendra.sun.com/iconDraw.gif\"/>\n"
1436: + "</IMG>";
1437:
1438: String[] lXMLAttributeRules = {
1439: "<Attribute name=\"href\" tag=\"xsl:choose\"/>"
1440: + "<Attribute name=\"path\" tag=\"*con\"/>"
1441: + "<Attribute name=\"value\" tag=\"attribute\"/>",
1442: "<Attribute name=\"href\" tag=\"*:choose\"/>"
1443: + "<Attribute name=\"path\" tag=\"*con\"/>"
1444: + "<Attribute name=\"value\" tag=\"attribute\"/>",
1445: "<Attribute name=\"href\" tag=\"*choose\"/>"
1446: + "<Attribute name=\"path\" tag=\"icon;Icon\"/>"
1447: + "<Attribute name=\"value\" tag=\"attribute\"/>",
1448: "<Attribute name=\"href*\" tag=\"xsl:choose\"/>"
1449: + "<Attribute name=\"path\" tag=\"Icon;icon\"/>"
1450: + "<Attribute name=\"value\" tag=\"attribute\"/>",
1451: "<Attribute name=\"*href*\" tag=\"xsl:choose\"/>"
1452: + "<Attribute name=\"path\" tag=\"*con;icon\"/>"
1453: + "<Attribute name=\"value\" tag=\"attribute\"/>",
1454: "<Attribute name=\"h*ef\" tag=\"xsl:choose\"/>"
1455: + "<Attribute name=\"pa*h\" tag=\"*c*n\"/>"
1456: + "<Attribute name=\"val*e\" tag=\"att*ribute\"/>", };
1457:
1458: for (int i = 0; i < lXMLAttributeRules.length; i++) {
1459: RuleSet lRuleSet = CreateRuleSet
1460: .withXMLAttributeRules(lXMLAttributeRules[i]);
1461:
1462: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1463: LanguageConstants.XML_MIME);
1464: String lResult = lRewriter.rewrite(lInput,
1465: getDefaultTranslator());
1466: assertXMLEqual("i=" + i, lExpectation, lResult);
1467: }
1468: }//testCaseSensitivityInAttribRulesVarient()
1469:
1470: public void testCaseSensitivityInAttribRulesNegative()
1471: throws Exception {
1472: String lInput = "<IMG xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" id=\"folderIcon\" width=\"16\" height=\"16\" border=\"0\" style=\"cursor:hand\">\n"
1473: + "<xsl:Choose href=\"abc.html\"></xsl:Choose>\n"
1474: + "<icon Path=\"/iconDraw.gif\"></icon>\n"
1475: + "<Attribute name=\"src\" value=\"/iconDraw.gif\"></Attribute>\n"
1476: + "</IMG>\n";
1477:
1478: String lExpectation = "<IMG xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" id=\"folderIcon\" width=\"16\" height=\"16\" border=\"0\" style=\"cursor:hand\">\n"
1479: + "<xsl:Choose href=\"http://rajanagendra.sun.com/Base/Raja/abc.html\"/>\n"
1480: + "<icon Path=\"http://rajanagendra.sun.com/iconDraw.gif\"/>\n"
1481: + "<Attribute name=\"src\" value=\"http://rajanagendra.sun.com/iconDraw.gif\"/>\n"
1482: + "</IMG>";
1483:
1484: String[] lXMLAtributeRule = {
1485: "<Attribute name=\"href\" tag=\"xsl:Choose\"/>"
1486: + "<Attribute name=\"Path\" tag=\"icon\"/>"
1487: + "<Attribute name=\"value\" tag=\"Attribute\"/>",
1488:
1489: "<Attribute name=\"href\" tag=\"*:Choose\"/>"
1490: + "<Attribute name=\"Path\" tag=\"icon\"/>"
1491: + "<Attribute name=\"value\" tag=\"Attribute\"/>",
1492:
1493: "<Attribute name=\"href\" tag=\"*hoose\"/>"
1494: + "<Attribute name=\"Path\" tag=\"icon\"/>"
1495: + "<Attribute name=\"value\" tag=\"Attribute\"/>",
1496:
1497: "<Attribute name=\"href*\" tag=\"xsl:Choose\"/>"
1498: + "<Attribute name=\"Path\" tag=\"icon\"/>"
1499: + "<Attribute name=\"value\" tag=\"Attribute\"/>",
1500:
1501: "<Attribute name=\"*href*\" tag=\"xsl:Choose\"/>"
1502: + "<Attribute name=\"Path\" tag=\"icon\"/>"
1503: + "<Attribute name=\"value\" tag=\"Attribute\"/>",
1504:
1505: "<Attribute name=\"h*ef\" tag=\"xsl:Choose\"/>"
1506: + "<Attribute name=\"Pa*h\" tag=\"ic*n\"/>"
1507: + "<Attribute name=\"val*e\" tag=\"*tt*ribute\"/>", };
1508:
1509: for (int i = 0; i < lXMLAtributeRule.length; i++) {
1510: RuleSet lRuleSet = CreateRuleSet
1511: .withXMLAttributeRules(lXMLAtributeRule[i]);
1512:
1513: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1514: LanguageConstants.XML_MIME);
1515: String lResult = lRewriter.rewrite(lInput,
1516: getDefaultTranslator());
1517: assertXMLEqual("i=" + i, lExpectation, lResult);
1518: }
1519: }//testCaseSensitivityInAttribRulesNegative()
1520:
1521: public void testCaseSensitivityInAttribRulesNegative1()
1522: throws Exception {
1523: String lInput = "<IMG xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" id=\"folderIcon\" width=\"16\" height=\"16\" border=\"0\" style=\"cursor:hand\">\n"
1524: + "<xsl:Choose href=\"abc.html\"></xsl:Choose>\n"
1525: + "<icon Path=\"/iconDraw.gif\"></icon>\n"
1526: + "<Attribute name=\"src\" value=\"/iconDraw.gif\"></Attribute>\n"
1527: + "</IMG>\n";
1528:
1529: String lExpectation = "<IMG xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" id=\"folderIcon\" width=\"16\" height=\"16\" border=\"0\" style=\"cursor:hand\">\n"
1530: + "<xsl:Choose href=\"abc.html\"/>\n"
1531: + "<icon Path=\"/iconDraw.gif\"/>\n"
1532: + "<Attribute name=\"src\" value=\"/iconDraw.gif\"/>\n"
1533: + "</IMG>";
1534:
1535: String[] lXMLAtributeRule = {
1536: "<Attribute name=\"href\" tag=\"xsl:choose\"/>"
1537: + "<Attribute name=\"path\" tag=\"icon\"/>"
1538: + "<Attribute name=\"value\" tag=\"attribute\"/>",
1539: "<Attribute name=\"href\" tag=\"*:choose\"/>"
1540: + "<Attribute name=\"path\" tag=\"icon\"/>"
1541: + "<Attribute name=\"value\" tag=\"attribute\"/>",
1542: "<Attribute name=\"href\" tag=\"*choose\"/>"
1543: + "<Attribute name=\"path\" tag=\"icon\"/>"
1544: + "<Attribute name=\"value\" tag=\"attribute\"/>",
1545: "<Attribute name=\"href*\" tag=\"xsl:choose\"/>"
1546: + "<Attribute name=\"path\" tag=\"icon\"/>"
1547: + "<Attribute name=\"value\" tag=\"attribute\"/>",
1548: "<Attribute name=\"*href*\" tag=\"xsl:choose\"/>"
1549: + "<Attribute name=\"path\" tag=\"icon\"/>"
1550: + "<Attribute name=\"value\" tag=\"attribute\"/>",
1551: "<Attribute name=\"h*ef\" tag=\"xsl:choose\"/>"
1552: + "<Attribute name=\"pa*h\" tag=\"ic*n\"/>"
1553: + "<Attribute name=\"val*e\" tag=\"att*ribute\"/>", };
1554:
1555: for (int i = 0; i < lXMLAtributeRule.length; i++) {
1556: RuleSet lRuleSet = CreateRuleSet
1557: .withXMLAttributeRules(lXMLAtributeRule[i]);
1558:
1559: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1560: LanguageConstants.XML_MIME);
1561: String lResult = lRewriter.rewrite(lInput,
1562: getDefaultTranslator());
1563: assertXMLEqual("i=" + i, lExpectation, lResult);
1564: }
1565: }//testCaseSensitivityInAttribRulesNegative1()
1566:
1567: public void testXSLRewritingOWA() throws Exception {
1568: String lInput = "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">\n"
1569: + " <xsl:if expr=\"true==bSpansDays\">\n"
1570: + " <IMG class='dailyApptImg' src='/exchweb/img/view-spanday2.gif' height='13' width='13' border='0'></IMG>\n"
1571: + " </xsl:if>\n"
1572: + " <xsl:if expr=\"nSensitivity=='2'\">\n"
1573: + " <IMG class='dailyApptImg' src='/exchweb/img/view-private2.gif' height='13' width='16' border='0'></IMG>\n"
1574: + " </xsl:if>\n" + "</xsl:stylesheet>\n";
1575:
1576: String lExpectation = "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\">\n"
1577: + " <xsl:if expr=\"true==bSpansDays\">\n"
1578: + " <IMG class=\"dailyApptImg\" src=\"http://rajanagendra.sun.com/exchweb/img/view-spanday2.gif\" height=\"13\" width=\"13\" border=\"0\"/>\n"
1579: + " </xsl:if>\n"
1580: + " <xsl:if expr=\"nSensitivity=='2'\">\n"
1581: + " <IMG class=\"dailyApptImg\" src=\"http://rajanagendra.sun.com/exchweb/img/view-private2.gif\" height=\"13\" width=\"16\" border=\"0\"/>\n"
1582: + " </xsl:if>\n" + "</xsl:stylesheet>";
1583:
1584: String lXMLAtributeRule = "<Attribute name=\"src\" tag=\"IMG\"/>";
1585:
1586: RuleSet lRuleSet = CreateRuleSet
1587: .withXMLAttributeRules(lXMLAtributeRule);
1588: Rewriter lRewriter = RewriterPool.create(lRuleSet,
1589: LanguageConstants.XML_MIME);
1590: String lResult = lRewriter.rewrite(lInput,
1591: getDefaultTranslator());
1592: assertXMLEqual(lExpectation, lResult);
1593: }//testXSLRewritingOWA()
1594:
1595: public void testXSLOWA() throws Exception {
1596: String lInput = "<!--Copyright (c) 2000-2001 Microsoft Corporation. All rights reserved. -->\n"
1597: + "<xsl:stylesheet xmlns:xsl=\"http://www.w3.org/TR/WD-xsl\" default-space=\"strip\">\n"
1598: + "<xsl:template match=\"@*\"><xsl:attribute><xsl:value-of select=\".\"/></xsl:attribute></xsl:template> \n"
1599: + "<xsl:template match=\"@style\"></xsl:template>\n"
1600: + "<xsl:template match=\"style\">\n"
1601: + "<xsl:value-of select=\".\" />\n"
1602: + "</xsl:template>\n"
1603: + "<xsl:template match=\"/\">\n"
1604: + "<xsl:element name=\"view\">\n"
1605: + "<xsl:choose>\n"
1606: + "<xsl:when test=\"/view/card\">\n"
1607: + "<xsl:element name=\"group\">\n"
1608: + "<xsl:element name=\"xsl:template\"><xsl:attribute name=\"xmlns:xsl\">uri:xsl</xsl:attribute><xsl:attribute name=\"xmlns:a\">DAV:</xsl:attribute>\n"
1609: + "<xsl:element name=\"xsl:for-each\"><xsl:attribute name=\"select\">a:multistatus/a:response</xsl:attribute>\n"
1610: + "<a id=\"unSelected\" onmousedown=\"event.returnValue=this\" ondblclick=\"event.returnValue=this\" onmouseup=\"event.returnValue=this\" onclick=\"return(false);\" tabindex=\"-1\"> \n"
1611: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\">href</xsl:attribute><xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\">a:href</xsl:attribute></xsl:element></xsl:element>\n"
1612: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\">_href</xsl:attribute><xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\">a:href</xsl:attribute></xsl:element></xsl:element>\n"
1613: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\">contentClass</xsl:attribute><xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\">a:propstat/a:prop/messageclass</xsl:attribute></xsl:element></xsl:element>\n"
1614: + "<xsl:element name=\"xsl:for-each\">\n"
1615: + "<xsl:attribute name=\"select\">a:propstat/a:prop</xsl:attribute>\n"
1616: + "<table cols=\"2\" width=\"100%\" style=\"font-size:x-small;\">\n"
1617: + "<tr>\n"
1618: + "<td>\n"
1619: + "<table width=\"100%\" style=\"table-layout:fixed\" cellpadding=\"0\" cellspacing=\"0\"><tr>\n"
1620: + "<td id=\"crdHeader1\" NOWRAP=\"true\" header=\"true\" style=\"height:1.5em;font-weight:bold;cursor:hand;background-color:threedface;color:menutext;width:99%\"><xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\">prop1</xsl:attribute></xsl:element> </td>\n"
1621: + "<td id=\"crdHeader2\" align=\"center\" header=\"true\" style=\"height:1.5em;font-weight:bold;cursor:hand;background-color:threedface;color:menutext;width:18px\">\n"
1622: + "<xsl:element name=\"xsl:if\">\n"
1623: + "<xsl:attribute name=\"test\">messageclass[. = 'IPM.DistList']</xsl:attribute>\n"
1624: + "<IMG id=\"imgTD\"><xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"></xsl:value-of>view-cdl.gif</xsl:attribute></IMG>\n"
1625: + "</xsl:element>\n"
1626: + "</td>\n"
1627: + "</tr></table>\n"
1628: + "</td>\n"
1629: + "</tr>\n"
1630: + "</table>\n"
1631: + "<table cols=\"2\" width=\"100%\" style=\"font-size:x-small;\">\n"
1632: + "<xsl:for-each select=\"view/column[index() $gt$ 0 and prop != 'http://schemas.microsoft.com/exchange/smallicon']\">\n"
1633: + "<xsl:element name=\"xsl:for-each\">\n"
1634: + "<xsl:attribute name=\"select\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval>[.!= '']</xsl:attribute>\n"
1635: + "<xsl:if test=\"visible[. = '1']\" >\n"
1636: + "<tr>\n"
1637: + "<td valign=\"top\" style=\"padding-right:5px\" NOWRAP=\"true\"><xsl:value-of select=\"heading\"/></td>\n"
1638: + "<td width=\"100%\"><xsl:element name=\"xsl:value-of\"></xsl:element></td>\n"
1639: + "</tr>\n"
1640: + "</xsl:if>\n"
1641: + "</xsl:element>\n"
1642: + "</xsl:for-each>\n"
1643: + "</table>\n"
1644: + "</xsl:element>\n"
1645: + "</a>\n"
1646: + "</xsl:element>\n"
1647: + "</xsl:element>\n"
1648: + "</xsl:element>\n"
1649: + "</xsl:when>\n"
1650: + "<xsl:otherwise>\n"
1651: + "<xsl:eval>var propNum=0;</xsl:eval>\n"
1652: + "<xsl:for-each select=\"view/groupby/order\">\n"
1653: + "<xsl:eval>propNum++</xsl:eval>\n"
1654: + "<xsl:element name=\"group\">\n"
1655: + "<xsl:element name=\"xsl:template\"><xsl:attribute name=\"xmlns:xsl\">uri:xsl</xsl:attribute>\n"
1656: + "<xsl:attribute name=\"xmlns:a\">DAV:</xsl:attribute>\n"
1657: + "<xsl:attribute name=\"xmlns:b\">urn:schemas:httpmail:</xsl:attribute>\n"
1658: + "<xsl:attribute name=\"xmlns:c\">urn:schemas:mailheader:</xsl:attribute>\n"
1659: + "<TABLE tabindex=\"-1\">\n"
1660: + "<xsl:apply-templates select=\"/view/viewstyle/@*\"/>\n"
1661: + "<xsl:attribute name=\"style\"><xsl:value-of select=\"/view/viewstyle\"/></xsl:attribute>\n"
1662: + "<xsl:element name=\"xsl:for-each\"><xsl:attribute name=\"select\">a:multistatus/a:response</xsl:attribute>\n"
1663: + "<TR id=\"groupHeaderRow\" isGroupHeader=\"true\" onmousedown=\"if(null == event.returnValue) event.returnValue=this;\" style=\"cursor:default\" ondragstart=\"event.cancelBubble=true;return(false);\">\n"
1664: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\">itemCount</xsl:attribute><xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\">a:propstat/a:prop/a:visiblecount</xsl:attribute></xsl:element></xsl:element>\n"
1665: + "<TD nowrap=\"true\" id=\"groupHeaderText\" ondblclick=\"if(null == event.returnValue) event.returnValue=this;\" ondragstart=\"event.cancelBubble=true;return(false);\">\n"
1666: + "<xsl:apply-templates select=\"style/@*\"/>\n"
1667: + "<xsl:attribute name=\"propName\"><xsl:value-of select=\"prop\" /></xsl:attribute>\n"
1668: + "<xsl:attribute name=\"dataType\"><xsl:value-of select=\"type\" /></xsl:attribute>\n"
1669: + "<xsl:attribute name=\"style\"><xsl:value-of select=\"style\" /></xsl:attribute>\n"
1670: + "<xsl:attribute name=\"groupLevel\"><xsl:eval>propNum</xsl:eval></xsl:attribute>\n"
1671: + "<xsl:element name=\"xsl:for-each\">\n"
1672: + "<xsl:attribute name=\"select\">a:propstat/a:prop/prop1</xsl:attribute>\n"
1673: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\">propValue</xsl:attribute><xsl:element name=\"xsl:eval\">this.text</xsl:element></xsl:element>\n"
1674: + "</xsl:element>\n"
1675: + "<IMG onmousedown=\"if(null == event.returnValue) event.returnValue=this\" id=\"groupHeaderActivator\" style=\"cursor:hand;vertical-align:middle\" ondragstart=\"event.cancelBubble=true;return(false);\">\n"
1676: + "<xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"></xsl:value-of>view-plus.gif</xsl:attribute> \n"
1677: + "</IMG>\n"
1678: + " \n"
1679: + "<SPAN id=\"groupHeaderSpan\" ondragstart=\"event.cancelBubble=true;return(false);\">\n"
1680: + "<xsl:choose>\n"
1681: + "<xsl:when test=\"/view/boldUnreadItems[. = 'true']\">\n"
1682: + "<xsl:element name=\"xsl:choose\">\n"
1683: + "<xsl:element name=\"xsl:when\">\n"
1684: + "<xsl:attribute name=\"test\">a:propstat/a:prop/b:unreadcount[. $igt$ '0']</xsl:attribute>\n"
1685: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\">style</xsl:attribute>cursor:default;vertical-align:middle;overflow:hidden;font-weight:bold</xsl:element>\n"
1686: + "</xsl:element>\n"
1687: + "<xsl:element name=\"xsl:otherwise\">\n"
1688: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\">style</xsl:attribute>cursor:default;vertical-align:middle;overflow:hidden</xsl:element>\n"
1689: + "</xsl:element>\n"
1690: + "</xsl:element>\n"
1691: + "</xsl:when>\n"
1692: + "<xsl:otherwise><xsl:attribute name=\"style\">cursor:default;vertical-align:middle;overflow:hidden</xsl:attribute></xsl:otherwise>\n"
1693: + "</xsl:choose>\n"
1694: + "<xsl:value-of select=\"heading\" />: <xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\">a:propstat/a:prop/prop1</xsl:attribute></xsl:element> \n"
1695: + "<xsl:choose>\n"
1696: + "<xsl:when test=\".[countlabel and unreadlabel]\">\n"
1697: + "(<xsl:value-of select=\"countlabel\" />: <xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\">a:propstat/a:prop/a:visiblecount</xsl:attribute></xsl:element>\n"
1698: + "<xsl:element name=\"xsl:if\">\n"
1699: + "<xsl:attribute name=\"test\">a:propstat/a:prop/b:unreadcount[. $igt$ '0']</xsl:attribute>\n"
1700: + ", <xsl:value-of select=\"unreadlabel\" />: <xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\">a:propstat/a:prop/b:unreadcount</xsl:attribute></xsl:element>\n"
1701: + "</xsl:element>)\n"
1702: + "</xsl:when>\n"
1703: + "<xsl:when test=\"countlabel\">\n"
1704: + "(<xsl:value-of select=\"countlabel\" />: <xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\">a:propstat/a:prop/a:visiblecount</xsl:attribute></xsl:element>)\n"
1705: + "</xsl:when>\n"
1706: + "<xsl:when test=\"unreadlabel\">\n"
1707: + "<xsl:element name=\"xsl:if\">\n"
1708: + "<xsl:attribute name=\"test\">a:propstat/a:prop/b:unreadcount[. $igt$ '0']</xsl:attribute>\n"
1709: + "(<xsl:value-of select=\"unreadlabel\" />: <xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\">a:propstat/a:prop/b:unreadcount</xsl:attribute></xsl:element>)\n"
1710: + "</xsl:element>\n"
1711: + "</xsl:when>\n"
1712: + "</xsl:choose>\n"
1713: + "</SPAN>\n"
1714: + "</TD>\n"
1715: + "</TR>\n"
1716: + "<TR id=\"groupContentRow\" style=\"display:none;\">\n"
1717: + "<TD id=\"groupContentCell\" nowrap=\"true\" style=\"padding-left:20px\"/>\n"
1718: + "</TR>\n"
1719: + "</xsl:element>\n"
1720: + "</TABLE>\n"
1721: + "</xsl:element>\n"
1722: + "</xsl:element>\n"
1723: + "</xsl:for-each>\n"
1724: + "<xsl:element name=\"group\">\n"
1725: + "<xsl:element name=\"xsl:template\">\n"
1726: + "<xsl:attribute name=\"xmlns:xsl\">uri:xsl</xsl:attribute>\n"
1727: + "<xsl:attribute name=\"xmlns:a\">DAV:</xsl:attribute>\n"
1728: + "\n"
1729: + "<xsl:element name=\"xsl:script\">\n"
1730: + "\n"
1731: + "var re=/^(\\d{4})-(\\d{2})-(\\d{2})T(\\d{2}):(\\d{2}):(\\d{2}).\\d{3}Z?$/;\n"
1732: + "\n"
1733: + "function getThreadIndexSpacing(szThreadIndex)\n"
1734: + "{\n"
1735: + "if(null == szThreadIndex || 0 == szThreadIndex.length) return \"\";\n"
1736: + "var iTemp = szThreadIndex.length - 32;\n"
1737: + "if (0 >= iTemp) return \"3px\";\n"
1738: + "var iSpaces = (3 * Math.floor(iTemp/20));\n"
1739: + "if (4 == (iTemp % 20)) iSpaces += 1;\n"
1740: + "else if (12 == (iTemp % 20)) iSpaces += 2;\n"
1741: + "iSpaces = (iSpaces * 16) + 3;\n"
1742: + "return iSpaces.toString() + \"px\";\n"
1743: + "}\n"
1744: + "\n"
1745: + "function formatMessageSize(szSize,szBAbbr,szKBAbbr,szMBAbbr)\n"
1746: + "{\n"
1747: + "if(\"\" == szBAbbr) szBAbbr = \"B\";\n"
1748: + "if(\"\" == szKBAbbr) szKBAbbr = \"KB\";\n"
1749: + "if(\"\" == szMBAbbr) szMBAbbr = \"MB\";\n"
1750: + "if(\"\" == szSize) szSize = \"0\";\n"
1751: + "\n"
1752: + "var iSize = parseInt(szSize,10);\n"
1753: + "if (iSize > 0x100000)\n"
1754: + "{\n"
1755: + "iSize = Math.round(iSize/1048576);\n"
1756: + "szSize = iSize + \" \" + szMBAbbr;\n"
1757: + "}\n"
1758: + "else if(iSize > 0x400)\n"
1759: + "{\n"
1760: + "iSize = Math.round(iSize/1024);\n"
1761: + "szSize = iSize + \" \" + szKBAbbr;\n"
1762: + "}\n"
1763: + "else\n"
1764: + "{\n"
1765: + "szSize = iSize + \" \" + szBAbbr;\n"
1766: + "}\n"
1767: + "return(szSize);\n"
1768: + "}\n"
1769: + "function formatDateTimeString(szISODate,szDateFormat,szTimeFormat)\n"
1770: + "{\n"
1771: + "re.lastIndex=0;\n"
1772: + "var arr = re.exec( szISODate );\n"
1773: + "if (null == arr) return \"\";\n"
1774: + "var objDate = new Date(Date.UTC(arr[1],arr[2]-1,arr[3],arr[4],arr[5],arr[6],0));\n"
1775: + "var szFormattedDate = formatDate(objDate.getVarDate(), szDateFormat);\n"
1776: + "var szFormattedTime = formatTime(objDate.getVarDate(), szTimeFormat);\n"
1777: + "//Check for null character and strip it off if present\n"
1778: + "if(szFormattedDate.charCodeAt(szFormattedDate.length -1) == 0)\n"
1779: + "{\n"
1780: + "szFormattedDate = szFormattedDate.substring(0,szFormattedDate.length-1) \n"
1781: + "}\n"
1782: + "return szFormattedDate + \" \" + szFormattedTime;\n"
1783: + "}\n"
1784: + "</xsl:element>\n"
1785: + "<TABLE isTabularView=\"true\" >\n"
1786: + "<xsl:apply-templates select=\"/view/viewstyle/@*\"/>\n"
1787: + "<xsl:attribute name=\"style\"><xsl:value-of select=\"/view/viewstyle\"/></xsl:attribute>\n"
1788: + "<!-- ****** Start Column heading xsl *********************** -->\n"
1789: + "<TR id=\"tblHeader\">\n"
1790: + "<xsl:apply-templates select=\"/view/headerstyle/@*\"/>\n"
1791: + "<xsl:attribute name=\"style\"><xsl:value-of select=\"/view/headerstyle\"/></xsl:attribute>\n"
1792: + "<xsl:for-each select=\"/view/column\">\n"
1793: + "<TD id=\"tdColumn\" onclick=\"if(null == event.returnValue) event.returnValue=this;\">\n"
1794: + "<xsl:choose>\n"
1795: + "<xsl:when test=\"visible[. = '0']\">\n"
1796: + "<xsl:attribute name=\"style\">display:none</xsl:attribute>\n"
1797: + "</xsl:when>\n"
1798: + "<xsl:otherwise>\n"
1799: + "<xsl:apply-templates select=\"headerstyle/@*\"/>\n"
1800: + "<xsl:attribute name=\"style\">\n"
1801: + "<xsl:choose>\n"
1802: + "<xsl:when test=\"headerstyle\"><xsl:value-of select=\"headerstyle\"/></xsl:when>\n"
1803: + "<xsl:otherwise>text-align:center;vertical-align:middle;cursor:hand</xsl:otherwise>\n"
1804: + "</xsl:choose>\n"
1805: + "</xsl:attribute>\n"
1806: + "</xsl:otherwise>\n"
1807: + "</xsl:choose>\n"
1808: + "<xsl:attribute name=\"prop\"><xsl:value-of select=\"prop\"/></xsl:attribute>\n"
1809: + "<xsl:attribute name=\"dataType\"><xsl:value-of select=\"type\" /></xsl:attribute>\n"
1810: + "<xsl:attribute name=\"colName\"><xsl:value-of select=\"heading\"/></xsl:attribute>\n"
1811: + "<xsl:attribute name=\"sortdir\"><xsl:value-of select=\"/view/orderby/order[prop = context()/prop]/sort\"/></xsl:attribute>\n"
1812: + "<xsl:attribute name=\"sortable\"><xsl:choose><xsl:when test=\"sortable[. = '0']\">0</xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose></xsl:attribute>\n"
1813: + "<xsl:choose>\n"
1814: + "<xsl:when test=\"prop[. = 'http://schemas.microsoft.com/exchange/x-priority-long']\">\n"
1815: + "<IMG id=\"imgCol\" style=\"cursor:hand\">\n"
1816: + "<xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"></xsl:value-of>view-importance.gif</xsl:attribute>\n"
1817: + "</IMG>\n"
1818: + "</xsl:when>\n"
1819: + "<xsl:when test=\"prop[. = 'urn:schemas:httpmail:hasattachment']\">\n"
1820: + "<IMG id=\"imgCol\" style=\"cursor:hand\" >\n"
1821: + "<xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"></xsl:value-of>view-paperclip.gif</xsl:attribute>\n"
1822: + "</IMG>\n"
1823: + "</xsl:when>\n"
1824: + "<xsl:when test=\"prop[. = 'http://schemas.microsoft.com/exchange/smallicon']\">\n"
1825: + "<IMG id=\"imgCol\" style=\"cursor:hand\" >\n"
1826: + "<xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"></xsl:value-of>view-document.gif</xsl:attribute>\n"
1827: + "</IMG>\n"
1828: + "</xsl:when>\n"
1829: + "<!-- Flag status col -->\n"
1830: + "<xsl:when test=\"prop[. = 'http://schemas.microsoft.com/mapi/proptag/x10900003']\">\n"
1831: + "<IMG id=\"imgCol\" style=\"cursor:hand\">\n"
1832: + "<xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"></xsl:value-of>view-flag.gif</xsl:attribute>\n"
1833: + "</IMG>\n"
1834: + "</xsl:when>\n"
1835: + "<xsl:otherwise>\n"
1836: + "<xsl:value-of select=\"heading\"/>\n"
1837: + "</xsl:otherwise>\n"
1838: + "</xsl:choose>\n"
1839: + "<xsl:choose>\n"
1840: + "<xsl:when test=\"bitmap[. = '1']\" />\n"
1841: + "<xsl:when test=\"sortable[. = '0']\"/>\n"
1842: + "<xsl:when test=\"/view/orderby/order[prop = context()/prop]/sort[. = 'DESC']\">\n"
1843: + "<IMG id=\"imgSortIndicator\">\n"
1844: + "<xsl:choose>\n"
1845: + "<xsl:when test=\"/view/sortdescicon\">\n"
1846: + "<xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"/><xsl:value-of select=\"/view/sortdescicon\"/></xsl:attribute>\n"
1847: + "</xsl:when>\n"
1848: + "<xsl:otherwise>\n"
1849: + "<xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"/>view-sortdown.gif</xsl:attribute>\n"
1850: + "</xsl:otherwise>\n"
1851: + "</xsl:choose>\n"
1852: + "</IMG>\n"
1853: + "</xsl:when>\n"
1854: + "<xsl:when test=\"/view/orderby/order[prop = context()/prop]/sort[. = 'ASC']\">\n"
1855: + "<IMG id=\"imgSortIndicator\">\n"
1856: + "<xsl:choose>\n"
1857: + "<xsl:when test=\"/view/sortascicon\">\n"
1858: + "<xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"/><xsl:value-of select=\"/view/sortascicon\"/></xsl:attribute>\n"
1859: + "</xsl:when>\n"
1860: + "<xsl:otherwise>\n"
1861: + "<xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"/>view-sortup.gif</xsl:attribute>\n"
1862: + "</xsl:otherwise>\n"
1863: + "</xsl:choose>\n"
1864: + "</IMG>\n"
1865: + "</xsl:when>\n"
1866: + "</xsl:choose>\n"
1867: + "</TD>\n"
1868: + "</xsl:for-each>\n"
1869: + "</TR>\n"
1870: + "<!-- ****** End Column heading xsl *********************** -->\n"
1871: + "<!-- ****** Start Property xsl *********************** -->\n"
1872: + "<xsl:element name=\"xsl:eval\">\n"
1873: + "var i=0;\n"
1874: + "</xsl:element>\n"
1875: + "<xsl:element name=\"xsl:for-each\"><xsl:attribute name=\"select\">a:multistatus/a:response</xsl:attribute>\n"
1876: + "<TR id=\"unSelected\" onmousedown=\"if(null == event.returnValue) event.returnValue=this\" onclick=\"if(null == event.returnValue) event.returnValue=this\" ondblclick=\"if(null == event.returnValue) event.returnValue=this\">\n"
1877: + "<xsl:choose>\n"
1878: + "<xsl:when test=\"view[rowstyle and altrowstyle]\">\n"
1879: + "<xsl:element name=\"xsl:choose\">\n"
1880: + "<xsl:element name=\"xsl:when\">\n"
1881: + "<xsl:attribute name=\"expr\">i++ %2</xsl:attribute>\n"
1882: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\">style</xsl:attribute><xsl:value-of select=\"view/altrowstyle\"/><xsl:if test=\"/view/boldUnreadItems[. = 'true']\"><xsl:element name=\"xsl:if\"><xsl:attribute name=\"test\">a:propstat/a:prop/read[.='0']</xsl:attribute>;font-weight:bold;</xsl:element></xsl:if></xsl:element>\n"
1883: + "<xsl:for-each select = \"view/altrowstyle/@*[nodeName() != 'style']\">\n"
1884: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\"><xsl:eval>this.nodeName</xsl:eval></xsl:attribute><xsl:value-of select=\".\"/></xsl:element>\n"
1885: + "</xsl:for-each>\n"
1886: + "</xsl:element>\n"
1887: + "<xsl:element name=\"xsl:otherwise\">\n"
1888: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\">style</xsl:attribute><xsl:value-of select=\"view/rowstyle\"/><xsl:if test=\"/view/boldUnreadItems[. = 'true']\"><xsl:element name=\"xsl:if\"><xsl:attribute name=\"test\">a:propstat/a:prop/read[.='0']</xsl:attribute>;font-weight:bold;</xsl:element></xsl:if></xsl:element>\n"
1889: + "<xsl:for-each select = \"view/rowstyle/@*[nodeName() != 'style']\">\n"
1890: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\"><xsl:eval>this.nodeName</xsl:eval></xsl:attribute><xsl:value-of select=\".\"/></xsl:element>\n"
1891: + "</xsl:for-each>\n"
1892: + "</xsl:element>\n"
1893: + "</xsl:element>\n"
1894: + "</xsl:when>\n"
1895: + "<xsl:when test=\"view/rowstyle\">\n"
1896: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\">style</xsl:attribute><xsl:value-of select=\"view/rowstyle\"/><xsl:if test=\"/view/boldUnreadItems[. = 'true']\"><xsl:element name=\"xsl:if\"><xsl:attribute name=\"test\">a:propstat/a:prop/read[.='0']</xsl:attribute>;font-weight:bold;</xsl:element></xsl:if></xsl:element>\n"
1897: + "<xsl:for-each select = \"view/rowstyle/@*[nodeName() != 'style']\">\n"
1898: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\"><xsl:eval>this.nodeName</xsl:eval></xsl:attribute><xsl:value-of select=\".\"/></xsl:element>\n"
1899: + "</xsl:for-each>\n"
1900: + "</xsl:when>\n"
1901: + "</xsl:choose>\n"
1902: + "<!-- Add messageClass to expando prop on the row \n"
1903: + "** Note - Do not add CRLF's here or xsl will output them with value\n"
1904: + "-->\n"
1905: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\">_href</xsl:attribute><xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\">a:href</xsl:attribute></xsl:element></xsl:element>\n"
1906: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\">_davhref</xsl:attribute><xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\">a:propstat/a:prop/davhref</xsl:attribute></xsl:element></xsl:element>\n"
1907: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\">messageClass</xsl:attribute><xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\">a:propstat/a:prop/messageclass</xsl:attribute></xsl:element></xsl:element>\n"
1908: + "<A onclick=\"return(false)\" tabindex=\"-1\">\n"
1909: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\">href</xsl:attribute>\n"
1910: + "<xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\">a:href</xsl:attribute></xsl:element></xsl:element>\n"
1911: + "<xsl:element name=\"xsl:for-each\"><xsl:attribute name=\"select\">a:propstat/a:prop</xsl:attribute>\n"
1912: + "<xsl:for-each select=\"view/column\">\n"
1913: + "<TD id=\"tableTD\">\n"
1914: + "<xsl:choose>\n"
1915: + "<xsl:when test=\"visible[. = '0']\">\n"
1916: + "<xsl:attribute name=\"style\">display:none</xsl:attribute>\n"
1917: + "</xsl:when>\n"
1918: + "<xsl:otherwise>\n"
1919: + "<xsl:apply-templates select=\"style/@*\"/>\n"
1920: + "<xsl:element name=\"xsl:attribute\">\n"
1921: + "<xsl:attribute name=\"name\">style</xsl:attribute>\n"
1922: + "<xsl:value-of select=\"style\"/>\n"
1923: + "<xsl:if test=\"indentcolumn[. = '1']\">\n"
1924: + "<xsl:element name=\"xsl:for-each\">\n"
1925: + "<xsl:attribute name=\"select\">threadindex</xsl:attribute>\n"
1926: + ";padding-left:<xsl:element name=\"xsl:eval\">getThreadIndexSpacing(this.text)</xsl:element>\n"
1927: + "</xsl:element>\n"
1928: + "</xsl:if>\n"
1929: + "</xsl:element>\n"
1930: + "</xsl:otherwise>\n"
1931: + "</xsl:choose>\n"
1932: + "<xsl:choose>\n"
1933: + "<!-- ****** Start Custom XSL Property *********************** -->\n"
1934: + "<xsl:when test=\"customxsl[. != '' and /view/xslpassthrough[@name = context()/customxsl]]\">\n"
1935: + "<xsl:for-each select=\"/view/xslpassthrough[@name = context()/customxsl]\">\n"
1936: + "<xsl:for-each><xsl:eval no-entities='t'>this.xml</xsl:eval></xsl:for-each>\n"
1937: + "</xsl:for-each>\n"
1938: + "</xsl:when>\n"
1939: + "<!-- ****** End Custom XSL Property *********************** -->\n"
1940: + "<!-- ****** Start Content Length Property xsl *********************** -->\n"
1941: + "<xsl:when test=\"prop[. = 'http://schemas.microsoft.com/mapi/proptag/x0e080003']\">\n"
1942: + "<xsl:element name=\"xsl:for-each\">\n"
1943: + "<xsl:attribute name=\"select\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval></xsl:attribute>\n"
1944: + "<xsl:element name=\"xsl:eval\">formatMessageSize(this.text,\"<xsl:value-of select='/view/byteabbreviation'/>\",\"<xsl:value-of select='/view/kilobyteabbreviation'/>\",\"<xsl:value-of select='/view/megabyteabbreviation'/>\")</xsl:element>\n"
1945: + "</xsl:element>\n"
1946: + "</xsl:when>\n"
1947: + "<!-- ****** End Content Length Property xsl *********************** -->\n"
1948: + "<!-- ****** Start Content Class Property xsl *********************** -->\n"
1949: + "<xsl:when test=\"prop[. = 'http://schemas.microsoft.com/exchange/smallicon']\">\n"
1950: + "<IMG width=\"16\" height=\"16\">\n"
1951: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\">src</xsl:attribute><xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval></xsl:attribute></xsl:element></xsl:element>\n"
1952: + "</IMG>\n"
1953: + "</xsl:when>\n"
1954: + "<!-- ****** End Content Class Property xsl *********************** -->\n"
1955: + "<!-- ****** Start Importance Property xsl *********************** -->\n"
1956: + "<xsl:when test=\"prop[. = 'http://schemas.microsoft.com/exchange/x-priority-long']\">\n"
1957: + "<xsl:element name=\"xsl:choose\">\n"
1958: + "<xsl:element name=\"xsl:when\">\n"
1959: + "<xsl:attribute name=\"test\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval>[.='0']</xsl:attribute>\n"
1960: + "<xsl:element name=\"IMG\">\n"
1961: + "<xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"></xsl:value-of>icon-lowimportance.gif</xsl:attribute>\n"
1962: + "<xsl:attribute name=\"style\">cursor:hand</xsl:attribute>\n"
1963: + "</xsl:element>\n"
1964: + "</xsl:element>\n"
1965: + "<xsl:element name=\"xsl:when\">\n"
1966: + "<xsl:attribute name=\"test\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval>[.='2']</xsl:attribute>\n"
1967: + "<xsl:element name=\"IMG\">\n"
1968: + "<xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"></xsl:value-of>icon-highimportance.gif</xsl:attribute>\n"
1969: + "<xsl:attribute name=\"style\">cursor:hand</xsl:attribute>\n"
1970: + "</xsl:element>\n"
1971: + "</xsl:element>\n"
1972: + "</xsl:element>\n"
1973: + "</xsl:when>\n"
1974: + "<!-- ****** End Importance Property xsl *********************** -->\n"
1975: + "<!-- ***** Start Flag Status Property xsl *********************** --> \n"
1976: + "<xsl:when test=\"prop[. = 'http://schemas.microsoft.com/mapi/proptag/x10900003']\">\n"
1977: + "<xsl:element name=\"xsl:choose\">\n"
1978: + "<xsl:element name=\"xsl:when\">\n"
1979: + "<xsl:attribute name=\"test\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval>[.='1']</xsl:attribute>\n"
1980: + "<xsl:element name=\"IMG\">\n"
1981: + "<xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"></xsl:value-of>icon-flag-complete.gif</xsl:attribute>\n"
1982: + "<xsl:attribute name=\"style\">cursor:hand</xsl:attribute>\n"
1983: + "</xsl:element>\n"
1984: + "</xsl:element>\n"
1985: + "<xsl:element name=\"xsl:when\">\n"
1986: + "<xsl:attribute name=\"test\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval>[.='2']</xsl:attribute>\n"
1987: + "<xsl:element name=\"IMG\">\n"
1988: + "<xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"></xsl:value-of>icon-flag.gif</xsl:attribute>\n"
1989: + "<xsl:attribute name=\"style\">cursor:hand</xsl:attribute>\n"
1990: + "</xsl:element>\n"
1991: + "</xsl:element>\n"
1992: + "</xsl:element>\n"
1993: + "</xsl:when>\n"
1994: + "<!-- ****** End Flag Status Property xsl *********************** -->\n"
1995: + "<!-- ****** Start has attachment Property xsl *********************** -->\n"
1996: + "<xsl:when test=\"prop[. = 'urn:schemas:httpmail:hasattachment']\">\n"
1997: + "<xsl:element name=\"xsl:choose\">\n"
1998: + "<xsl:element name=\"xsl:when\">\n"
1999: + "<xsl:attribute name=\"test\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval>[.='1']</xsl:attribute>\n"
2000: + "<xsl:element name=\"IMG\">\n"
2001: + "<xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"></xsl:value-of>icon-paperclip.gif</xsl:attribute>\n"
2002: + "<xsl:attribute name=\"style\">cursor:hand</xsl:attribute>\n"
2003: + "</xsl:element>\n"
2004: + "</xsl:element>\n"
2005: + "</xsl:element>\n"
2006: + "</xsl:when>\n"
2007: + "<!-- ****** End has attachment Property xsl *********************** -->\n"
2008: + "<!-- ****** Start boolean properties xsl *********************** -->\n"
2009: + "<xsl:when test=\"type[. = 'boolean' and context()/format[. = 'boolicon']]\">\n"
2010: + "<xsl:choose>\n"
2011: + "<xsl:when test=\".[booltrueicon and boolfalseicon]\">\n"
2012: + "<xsl:element name=\"xsl:choose\">\n"
2013: + "<xsl:element name=\"xsl:when\">\n"
2014: + "<xsl:attribute name=\"test\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval>[. = '1']</xsl:attribute>\n"
2015: + "<IMG><xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"/><xsl:value-of select=\"booltrueicon\"/></xsl:attribute></IMG>\n"
2016: + "</xsl:element>\n"
2017: + "<xsl:element name=\"xsl:when\">\n"
2018: + "<xsl:attribute name=\"test\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval>[. = '0']</xsl:attribute>\n"
2019: + "<IMG><xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"/><xsl:value-of select=\"boolfalseicon\"/></xsl:attribute></IMG>\n"
2020: + "</xsl:element>\n"
2021: + "</xsl:element>\n"
2022: + "</xsl:when>\n"
2023: + "<xsl:when test=\"booltrueicon\">\n"
2024: + "<xsl:element name=\"xsl:if\">\n"
2025: + "<xsl:attribute name=\"test\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval>[. = '1']</xsl:attribute>\n"
2026: + "<IMG><xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"/><xsl:value-of select=\"booltrueicon\"/></xsl:attribute></IMG>\n"
2027: + "</xsl:element>\n"
2028: + "</xsl:when>\n"
2029: + "<xsl:when test=\"boolfalseicon\">\n"
2030: + "<xsl:element name=\"xsl:if\">\n"
2031: + "<xsl:attribute name=\"test\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval>[. = '0']</xsl:attribute>\n"
2032: + "<IMG><xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"/><xsl:value-of select=\"boolfalseicon\"/></xsl:attribute></IMG>\n"
2033: + "</xsl:element>\n"
2034: + "</xsl:when>\n"
2035: + "<xsl:otherwise>\n"
2036: + "<xsl:element name=\"xsl:if\">\n"
2037: + "<xsl:attribute name=\"test\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval>[. = '1']</xsl:attribute>\n"
2038: + "<IMG><xsl:attribute name=\"src\"><xsl:value-of select=\"/view/imagepath\"/>view-check.gif</xsl:attribute></IMG>\n"
2039: + "</xsl:element>\n"
2040: + "</xsl:otherwise>\n"
2041: + "</xsl:choose>\n"
2042: + "</xsl:when>\n"
2043: + "<!-- ****** End boolean properties xsl *********************** -->\n"
2044: + "<!-- ****** Start non special properties xsl *********************** -->\n"
2045: + "<xsl:otherwise>\n"
2046: + "<xsl:element name=\"xsl:choose\">\n"
2047: + "<xsl:element name=\"xsl:when\">\n"
2048: + "<xsl:attribute name=\"test\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval>[@b:dt = 'mv.string']</xsl:attribute>\n"
2049: + "<xsl:element name=\"xsl:for-each\">\n"
2050: + "<xsl:attribute name=\"select\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval>/*</xsl:attribute>\n"
2051: + "<xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\">.</xsl:attribute></xsl:element><xsl:element name=\"xsl:if\"><xsl:attribute name=\"test\">context()[not(end())]</xsl:attribute>, </xsl:element>\n"
2052: + "</xsl:element>\n"
2053: + "</xsl:element>\n"
2054: + "<xsl:element name=\"xsl:when\">\n"
2055: + "<xsl:attribute name=\"test\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval>[@b:dt = 'int' or @b:dt = 'float' or @b:dt = 'i1' or @b:dt = 'i2' or @b:dt = 'i4' or @b:dt = 'i8' or @b:dt = 'ui1' or @b:dt = 'ui2' or @b:dt = 'ui4' or @b:dt = 'ui8' or @b:dt = 'r4' or @b:dt = 'r8']</xsl:attribute>\n"
2056: + "<xsl:element name=\"xsl:for-each\">\n"
2057: + "<xsl:attribute name=\"select\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval></xsl:attribute>\n"
2058: + "<xsl:element name=\"xsl:eval\">formatNumber(new Number(this.text), \"<xsl:value-of select='format' />\")</xsl:element>\n"
2059: + "</xsl:element>\n"
2060: + "</xsl:element>\n"
2061: + "<xsl:element name=\"xsl:when\">\n"
2062: + "<xsl:attribute name=\"test\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval>[@b:dt = 'dateTime.tz' or @b:dt = 'dateTime']</xsl:attribute>\n"
2063: + "<xsl:element name=\"xsl:for-each\">\n"
2064: + "<xsl:attribute name=\"select\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval></xsl:attribute>\n"
2065: + "<xsl:element name=\"xsl:eval\">formatDateTimeString(this.text, \"<xsl:value-of select='dateformat' />\", \"<xsl:value-of select='timeformat' />\")</xsl:element>\n"
2066: + "</xsl:element>\n"
2067: + "</xsl:element>\n"
2068: + "<xsl:element name=\"xsl:otherwise\">\n"
2069: + "<xsl:choose>\n"
2070: + "<xsl:when test=\"bitmap[. = '1']\">\n"
2071: + "<xsl:element name=\"xsl:if\">\n"
2072: + "<xsl:attribute name=\"test\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval>[. != '']</xsl:attribute>\n"
2073: + "<IMG>\n"
2074: + "<xsl:element name=\"xsl:attribute\"><xsl:attribute name=\"name\">src</xsl:attribute><xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval></xsl:attribute></xsl:element></xsl:element>\n"
2075: + "</IMG>\n"
2076: + "</xsl:element>\n"
2077: + "</xsl:when>\n"
2078: + "<xsl:otherwise>\n"
2079: + "<xsl:element name=\"xsl:value-of\"><xsl:attribute name=\"select\"><xsl:eval>\"prop\" + childNumber(this)</xsl:eval></xsl:attribute></xsl:element>\n"
2080: + "</xsl:otherwise>\n"
2081: + "</xsl:choose>\n"
2082: + "</xsl:element>\n"
2083: + "</xsl:element>\n"
2084: + "</xsl:otherwise>\n"
2085: + "<!-- ****** End non special properties xsl *********************** -->\n"
2086: + "</xsl:choose>\n"
2087: + "</TD>\n"
2088: + "</xsl:for-each>\n"
2089: + "</xsl:element>\n"
2090: + "</A>\n"
2091: + "</TR>\n"
2092: + "</xsl:element>\n"
2093: + "</TABLE>\n"
2094: + "<!-- ****** End Property xsl *********************** -->\n"
2095: + "</xsl:element>\n"
2096: + "</xsl:element>\n"
2097: + "</xsl:otherwise>\n"
2098: + "</xsl:choose>\n"
2099: + "</xsl:element>\n"
2100: + "</xsl:template>\n"
2101: + "</xsl:stylesheet>\n";
2102:
2103: String lXMLRules = "<Attribute name=\"src\" tag=\"IMG\" /> \n"
2104: + "<TagText tag=\"d:smallicon\" />\n"
2105: + "<TagText tag=\"g:smallicon\" />\n"
2106: + "<TagText tag=\"icon\" />\n"
2107: + "<TagText tag=\"URL\" />\n"
2108: + "<TagText tag=\"d:msgfolderroot\" />\n"
2109: + "<TagText tag=\"d:sendmsg\" />\n"
2110: + "<TagText tag=\"d:outbox\" />\n"
2111: + "<TagText tag=\"d:drafts\" />\n"
2112: + "<TagText tag=\"d:contacts\" />\n"
2113: + "<TagText tag=\"d:deleteditems\" />\n"
2114: + "<TagText tag=\"d:sentitems\" />\n"
2115: + "<TagText tag=\"d:calendar\" />\n"
2116: + "<TagText tag=\"d:inbox\" />\n"
2117: + "<TagText tag=\"e:smallicon\" />\n"
2118: + "<TagText tag=\"davhref\" />\n"
2119: + "<TagText tag=\"imagepath\" />\n"
2120: + "<TagText tag=\"baseroot\" />\n"
2121: + "<TagText tag=\"a:href\" />\n"
2122: + "<TagText tag=\"prop2\" />\n"
2123: + "<TagText tag=\"img\" />\n";
2124:
2125: RuleSet lRuleSet = CreateRuleSet
2126: .withXMLAttributeRules(lXMLRules);
2127: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2128: LanguageConstants.XML_MIME);
2129: String lResult = lRewriter.rewrite(lInput,
2130: getDefaultTranslator());
2131: assertXMLEqual(lInput, lResult);
2132:
2133: //dobule check if the rewritten is still a valid xsl
2134: String lResult1 = lRewriter.rewrite(lResult
2135: + "<!--abc comment-->", getDefaultTranslator());
2136: assertXMLEqual(lInput, lResult1);
2137: }//testXSLOWA()
2138:
2139: public void testBugNo4778676AttributeEntities() throws Exception {
2140: String lInput = "<a:multistatus xmlns:a=\"DAV:\">\n"
2141: + "<a:href rajaAttrib=\"raja.html<,3<,movie.html>\"/>\n"
2142: + "</a:multistatus>";
2143:
2144: String lExpectation = "<a:multistatus xmlns:a=\"DAV:\">\n"
2145: + "<a:href rajaAttrib=\"http://rajanagendra.sun.com/Base/Raja/raja.html<,3<,http://rajanagendra.sun.com/Base/Raja/movie.html>\"/>\n"
2146: + "</a:multistatus>";
2147:
2148: String[] lAttributeRules = {
2149: "<Attribute name=\"rajaAttrib\" valuePatterns=\"**,3*,**html\" />", //4
2150: "<Attribute name=\"rajaAttrib\" tag=\"*\" valuePatterns=\"**,3*,**html\" />", //4
2151: "<Attribute name=\"rajaAttrib\" tag=\"a:*\" valuePatterns=\"**,3*,**html\" />", //4
2152: "<Attribute name=\"rajaAttrib\" tag=\"*href\" valuePatterns=\"**,*,**html\" />", //4
2153: "<Attribute name=\"rajaAttrib\" tag=\"*:href\" valuePatterns=\"**,*,**html\" />", //4
2154: "<Attribute name=\"rajaAttrib\" tag=\"a*href\" valuePatterns=\"**,*3*,**html\" />", //4
2155: "<Attribute name=\"rajaAttrib\" tag=\"a:*href\" valuePatterns=\"**,*,**html\" />", //4
2156: };
2157:
2158: for (int i = 0; i < lAttributeRules.length; i++) {
2159: RuleSet lRuleSet = CreateRuleSet
2160: .withXMLAttributeRules(lAttributeRules[i]);
2161: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2162: LanguageConstants.XML_MIME);
2163: String lResult = lRewriter.rewrite(lInput,
2164: getDefaultTranslator());
2165: assertXMLEqual("Failed at i=" + i, lExpectation, lResult);
2166: }//for
2167: }//testBugNo4778676AttributeEntities()
2168:
2169: public void testDobuleQuotesInAttributeValue() throws Exception {
2170: String lInput = "<a:multistatus xmlns:a='DAV:'>\n"
2171: + "<abc a='D\"AV:'/>\n" + "<abc a='D\\AV:'/>\n"
2172: + "<abc a='D\\"AV:'/>\n" + "</a:multistatus>";
2173:
2174: String lExpectation = "<a:multistatus xmlns:a=\"DAV:\">\n"
2175: + "<abc a='D\"AV:'/>\n" + "<abc a=\"D\\AV:\"/>\n"
2176: + "<abc a='D\\\"AV:'/>\n" + "</a:multistatus>";
2177:
2178: RuleSet lRuleSet = CreateRuleSet.emptyRuleSet();
2179: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2180: LanguageConstants.XML_MIME);
2181: String lResult = lRewriter.rewrite(lInput,
2182: getDefaultTranslator());
2183: assertXMLEqual(lExpectation, lResult);
2184: this .assertXMLEqual(lInput, lResult);
2185: }//testDobuleQuotesInAttributeValue()
2186:
2187: public void testSingleQuotAttributes() throws Exception {
2188: String lInput = "<XML>"
2189: + "<SPAN onclick='idTreeMenu.hide();MenuSelect(\\"Refresh\\");'/>"
2190: + "<SPAN onclick=\"idTreeMenu.hide();MenuSelect(\\"Refresh\\");\"/>"
2191: + "</XML>";
2192:
2193: String lExpectation = "<XML>"
2194: + "<SPAN onclick='idTreeMenu.hide();MenuSelect(\\\"Refresh\\\");'></SPAN>"
2195: + "<SPAN onclick='idTreeMenu.hide();MenuSelect(\\\"Refresh\\\");'></SPAN>"
2196: + "</XML>";
2197:
2198: RuleSet lRuleSet = CreateRuleSet.emptyRuleSet();
2199: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2200: LanguageConstants.XML_MIME);
2201: String lResult = lRewriter.rewrite(lInput,
2202: getDefaultTranslator());
2203: assertXMLEqual(lInput, lResult);
2204: }//testSingleQuiteAttributes()
2205:
2206: public void testMultiTagSameAttributeName() throws Exception {
2207: String lInput = "<xml id=\"imandata\">\n"
2208: + "<lines>\n"
2209: + "<line tag=\"ANGJmlwHQS4FxA\" name=\"047132\"\n"
2210: + "link=\"/cgi-bin/iman/ANGJmlwHQS4FxA\" type=\"Item\" class=\"Item\">\n"
2211: + "<prop name=\"object_desc\">047132</prop>\n"
2212: + "<prop name=\"last_mod_user\" link=\"/cgi-bin/iman/gp2UDNafQS4FxA\"\n"
2213: + "class=\"User\">gast</prop>\n"
2214: + "<prop name=\"actions\"/><prop name=\"object_type\">Item</prop>\n"
2215: + "<prop name=\"relation\"/><prop name=\"owning_user\"\n"
2216: + "link=\"/cgi-bin/iman/gp2UDNafQS4FxA\" class=\"User\">gast</prop>\n"
2217: + "<prop name=\"owning_group\" link=\"/cgi-bin/iman/Aw9YmJcLQS4FxA\"\n"
2218: + "class=\"Group\">visitor</prop>\n"
2219: + "<prop name=\"last_mod_date\">05-Dec-2002 09:36</prop>\n"
2220: + "<prop name=\"checked_out\"></prop>\n"
2221: + "<prop name=\"release_status_list\"></prop>\n"
2222: + "<children type=\"GRM\"\n"
2223: + "link=\"/cgi-bin/iman/ANGJmlwHQS4FxA?IMAN_file=data/wsochildren.xml\"/>\n"
2224: + "<children type=\"WhereUsed\"\n"
2225: + "link=\"/cgi-bin/iman/ANGJmlwHQS4FxA?IMAN_file=data/whereused.xml\"/>\n"
2226: + "<children type=\"WhereReferenced\"\n"
2227: + "link=\"/cgi-bin/iman/ANGJmlwHQS4FxA?IMAN_file=data/wherereferenced.xml\"/>\n"
2228: + "</line>\n" + "</lines>\n" + "</xml>\n";
2229:
2230: String lExpectation = "<xml id=\"imandata\">\n"
2231: + "<lines>\n"
2232: + "<line tag=\"ANGJmlwHQS4FxA\" name=\"047132\" link=\"http://rajanagendra.sun.com/cgi-bin/iman/ANGJmlwHQS4FxA\" type=\"Item\" class=\"Item\">\n"
2233: + "<prop name=\"object_desc\">047132</prop>\n"
2234: + "<prop name=\"last_mod_user\" link=\"http://rajanagendra.sun.com/cgi-bin/iman/gp2UDNafQS4FxA\" class=\"User\">gast</prop>\n"
2235: + "<prop name=\"actions\"/><prop name=\"object_type\">Item</prop>\n"
2236: + "<prop name=\"relation\"/><prop name=\"owning_user\" link=\"http://rajanagendra.sun.com/cgi-bin/iman/gp2UDNafQS4FxA\" class=\"User\">gast</prop>\n"
2237: + "<prop name=\"owning_group\" link=\"http://rajanagendra.sun.com/cgi-bin/iman/Aw9YmJcLQS4FxA\" class=\"Group\">visitor</prop>\n"
2238: + "<prop name=\"last_mod_date\">05-Dec-2002 09:36</prop>\n"
2239: + "<prop name=\"checked_out\"/>\n"
2240: + "<prop name=\"release_status_list\"/>\n"
2241: + "<children type=\"GRM\" link=\"http://rajanagendra.sun.com/cgi-bin/iman/ANGJmlwHQS4FxA?IMAN_file=data/wsochildren.xml\"/>\n"
2242: + "<children type=\"WhereUsed\" link=\"http://rajanagendra.sun.com/cgi-bin/iman/ANGJmlwHQS4FxA?IMAN_file=data/whereused.xml\"/>\n"
2243: + "<children type=\"WhereReferenced\" link=\"http://rajanagendra.sun.com/cgi-bin/iman/ANGJmlwHQS4FxA?IMAN_file=data/wherereferenced.xml\"/>\n"
2244: + "</line>\n" + "</lines>\n" + "</xml>";
2245:
2246: String[] lXMLAttRules = {
2247: "<Attribute name=\"link\"/>",
2248: "<Attribute name=\"link\" tag='*'/>",
2249: "<Attribute name=\"link\" tag='children;prop;line'/>",
2250: "<Attribute name=\"link\" tag='children'/>"
2251: + "<Attribute name=\"link\" tag='prop'/>"
2252: + "<Attribute name=\"link\" tag='line'/>", };
2253:
2254: for (int i = 0; i < lXMLAttRules.length; i++) {
2255: RuleSet lRuleSet = CreateRuleSet
2256: .withXMLAttributeRules(lXMLAttRules[i]);
2257: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2258: LanguageConstants.XML_MIME);
2259: String lResult = lRewriter.rewrite(lInput,
2260: getDefaultTranslator());
2261: assertXMLEqual(lExpectation, lResult);
2262: }
2263: }//testMultiTagSameAttributeName()
2264:
2265: public void testBugNo4882045() throws Exception {
2266: String lInput = "<xml>\n"
2267: + "<example url='abc.html'>test</example>\n"
2268: + "<example2 url='abc.com'>/test2</example2>\n"
2269: + "</xml>\n";
2270:
2271: String lExpectation = "<xml>\n"
2272: + "<example url=\"http://rajanagendra.sun.com/Base/Raja/abc.html\">test</example>\n"
2273: + "<example2 url=\"http://rajanagendra.sun.com/Base/Raja/abc.com\">/test2</example2>\n"
2274: + "</xml>";
2275:
2276: String[] lXMLAttRules = { "<Attribute name=\"url\" tag='*'/>",
2277: "<Attribute name=\"url\"/>",
2278: "<Attribute name=\"ur*l\" tag='*'/>",
2279: "<Attribute name=\"u*l\" tag='exam*'/>", };
2280: for (int i = 0; i < lXMLAttRules.length; i++) {
2281: RuleSet lRuleSet = CreateRuleSet
2282: .withXMLAttributeRules(lXMLAttRules[i]);
2283: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2284: LanguageConstants.XML_MIME);
2285: String lResult = lRewriter.rewrite(lInput,
2286: getDefaultTranslator());
2287: assertXMLEqual(lExpectation, lResult);
2288: }
2289: }//testBugNo4882045()
2290:
2291: public void testBugNo4882045Varient() throws Exception {
2292: String lInput = "<xml>\n"
2293: + "<example url = \n 'abc.html'>test</example>\n"
2294: + "<example url='abc.html'>test/../../abc.html</example>\n"
2295: + "<example url='abc.html'>../test</example>\n"
2296: + "<example2 url='abc.com'>/test2</example2>\n"
2297: + "</xml>\n";
2298:
2299: String lExpectation = "<xml>\n"
2300: + "<example url=\"http://rajanagendra.sun.com/Base/Raja/abc.html\">http://rajanagendra.sun.com/Base/Raja/test</example>\n"
2301: + "<example url=\"http://rajanagendra.sun.com/Base/Raja/abc.html\">http://rajanagendra.sun.com/Base/abc.html</example>\n"
2302: + "<example url=\"http://rajanagendra.sun.com/Base/Raja/abc.html\">http://rajanagendra.sun.com/Base/test</example>\n"
2303: + "<example2 url=\"http://rajanagendra.sun.com/Base/Raja/abc.com\">http://rajanagendra.sun.com/test2</example2>\n"
2304: + "</xml>";
2305:
2306: String[] lXMLAttRules = { "<Attribute name=\"url\" tag='*'/>",
2307: "<Attribute name=\"url\"/>",
2308: "<Attribute name=\"ur*l\" tag='*'/>",
2309: "<Attribute name=\"u*l\" tag='exam*'/>", };
2310:
2311: String[] lXMLTagTextRules = {
2312: //"<TagText tag=\"*\" attributePatterns=\"url=*\" /> \n", //invalid tag value
2313: "<TagText tag=\"example*\" attributePatterns=\"url=*\" /> \n",
2314: "<TagText tag=\"*m*\" attributePatterns=\"url=*\" /> \n",
2315: "<TagText tag=\"*example*\" attributePatterns=\"url=*\" /> \n",
2316: "<TagText tag=\"example;example2\" attributePatterns=\"u*l=a*c*\" /> \n",
2317: "<TagText tag=\"example*\" attributePatterns=\"url=abc*\" /> \n", };
2318:
2319: for (int i = 0; i < lXMLAttRules.length; i++) {
2320: for (int j = 0; j < lXMLTagTextRules.length; j++) {
2321: RuleSet lRuleSet = CreateRuleSet
2322: .withXMLAttTagTextRules(lXMLAttRules[i],
2323: lXMLTagTextRules[j]);
2324: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2325: LanguageConstants.XML_MIME);
2326: String lResult = lRewriter.rewrite(lInput,
2327: getDefaultTranslator());
2328: assertXMLEqual(lExpectation, lResult);
2329: }
2330: }
2331: }//testBugNo4882045Varient()
2332:
2333: public void testIncludeHREFInXSL() throws Exception {
2334: String lInput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
2335: + "<?xml-stylesheet type=\"text/xsl\" href=\"hosmmin1.xsl\"?>\n"
2336: + "<root>\n" + "</root>\n";
2337:
2338: String lExpectation = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
2339: + "<?xml-stylesheet type=\"text/xsl\" href=\"http://rajanagendra.sun.com/Base/Raja/hosmmin1.xsl\"?>\n"
2340: + "<root>\n" + "</root>";
2341:
2342: String[] lXMLAttRules = { "<Attribute name=\"href\"/>",
2343: "<Attribute name=\"href\" tag='*'/>",
2344: "<Attribute name=\"href\" tag='xml-stylesheet'/>", };
2345:
2346: for (int i = 0; i < lXMLAttRules.length; i++) {
2347: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
2348: lXMLAttRules[i], "");
2349: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2350: LanguageConstants.XML_MIME);
2351: String lResult = lRewriter.rewrite(lInput,
2352: getDefaultTranslator());
2353: assertXMLEqual(lExpectation, lResult);
2354: }
2355: }//testIncludeHREFInXSL()
2356:
2357: public void testIncludeHREFInXSL1() throws Exception {
2358: String lInput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
2359: + "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"><xsl:output method=\"html\" encoding=\"ISO-8859-1\"></xsl:output><xsl:template match=\"/\"><html id=\"\"><head id=\"\"><script language=\"javascript\" src=\"abysal.js\"></script><script language=\"javascript\" src=\"hospeweb.js\"></script><title>D.G.P. - Partes de viajeros identificacin</title><link type=\"text/css\" href=\"recursos/dgpgene.css\" rel=\"stylesheet\"></link><link type=\"text/css\" href=\"recursos/dgphospe.css\" rel=\"stylesheet\"></link><meta charset=\"iso-8859-1\" http-equiv=\"Context-Type\" content=\"text/html\"></meta><script language=\"javascript\">//\n"
2360: + "function Inicializar ()\n"
2361: + "{\n"
2362: + " putFocus('usuario');\n"
2363: + "}\n"
2364: + "\n"
2365: + "function Botones (tipo)\n"
2366: + "{\n"
2367: + " if (tipo == 'continuar')\n"
2368: + " {\n"
2369: + " if (isBlankOrNull(document.getElementById('usuario')))\n"
2370: + " alert ('Debe indicar usuario');\n"
2371: + " else\n"
2372: + " if (isBlankOrNull(document.getElementById('claveact')))\n"
2373: + " alert ('Debe indicar su clave');\n"
2374: + " else\n"
2375: + " if (isBlankOrNull(document.getElementById('contraact')))\n"
2376: + " alert ('Debe indicar su contrase?a');\n"
2377: + " else\n"
2378: + " {\n"
2379: + " var lista =\n"
2380: + " new Array('abysal_debug','0',\n"
2381: + " 'abysal_user', document.getElementById('usuario').value,\n"
2382: + " 'usuario', document.getElementById('usuario').value,\n"
2383: + " 'claveact', document.getElementById('claveact').value,\n"
2384: + " 'contraact', document.getElementById('contraact').value);\n"
2385: + " DoCallSec('hospwin1',lista);\n"
2386: + " }\n"
2387: + " }\n"
2388: + " else\n"
2389: + " {\n"
2390: + " alert ('Opcin no implementada');\n"
2391: + " }\n"
2392: + "\n"
2393: + "}\n"
2394: + "\n"
2395: + "function TeclaPulsada( eventoPulsaTecla )\n"
2396: + "{\n"
2397: + " bc = new browser_check;\n"
2398: + " if (bc.ns6)\n"
2399: + " tecla = eventoPulsaTecla.which;\n"
2400: + " else\n"
2401: + " if (bc.ie)\n"
2402: + " tecla = window.event.keyCode;\n"
2403: + " if (tecla == 13)\n"
2404: + " {\n"
2405: + " Botones('continuar');\n"
2406: + " }\n"
2407: + "}\n"
2408: + "\n"
2409: + "\n"
2410: + "document.onkeypress = TeclaPulsada;</script></head><body id=\"consultas\" onload=\"DoInit(); Inicializar()\" style=\"font-family:verdana, arial; margin:1px; margin-top:0px; background-color: #C9D7F2;\"><xsl:apply-templates></xsl:apply-templates></body></html></xsl:template><xsl:template match=\"root\"><form action=\"abysal\" method=\"post\"><input type=\"hidden\" name=\"abysal_program\" value=\"{abysal_program}\"></input><input type=\"hidden\" name=\"abysal_command\" value=\"{abysal_command}\"></input><img id=\"ack\" name=\"ack\" style=\"display:none\"></img></form><input type=\"hidden\" id=\"apliaux\" name=\"apliaux\" value=\"{aplicacion}\"></input><table cellspacing=\"0\" cellpadding=\"0\" id=\"tablaPadre\" border=\"0\" align=\"left\" height=\"100%\"><xsl:call-template name=\"cab-hos-sinfecha\"></xsl:call-template><tr><xsl:call-template name=\"margen-izda\"></xsl:call-template><td><table style=\"background-image: url(recursos/hosp-tapiz.gif);background-repeat: no-repeat;background-position: center center\" border=\"0\" align=\"center\" height=\"100%\"><tr><td valign=\"top\"><table border=\"0\" width=\"100%\" id=\"contenido\"><tr><td>?</td></tr><tr><td>?</td></tr><tr><td align=\"center\" colspan=\"2\"><font style=\"font-size: 24px; font-weight:bold; color:#104a7b\">CONTROL DE ACCESOS</font></td></tr><tr><td>?</td></tr><tr><td>?</td></tr><tr><td align=\"right\"><font style=\"font-size: 14px; font-weight:bold; color:#104a7b\">Usuario?</font></td><td align=\"left\"><input TYPE=\"text\" id=\"usuario\" value=\"{usuario}\" maxlength=\"10\" tabindex=\"1\" onkeypress=\"autinput(this,true,true)\" style=\"width:100px; font-size:14px\" name=\"usuario\"></input></td></tr><tr><td align=\"right\"><font style=\"font-size: 14px; font-weight:bold; color:#104a7b\">Clave?</font></td><td align=\"left\"><input TYPE=\"password\" id=\"claveact\" value=\"{claveact}\" maxlength=\"8\" tabindex=\"2\" onkeypress=\"autinput(this,true,false)\" style=\"width:100px; font-size:14px\" name=\"claveact\"></input></td></tr><tr><td align=\"right\"><font style=\"font-size: 14px; font-weight:bold; color:#104a7b\">Contrase?a?</font></td><td align=\"left\"><input TYPE=\"password\" id=\"contraact\" value=\"{contraact}\" maxlength=\"8\" tabindex=\"3\" onkeypress=\"autinput(this,true,false)\" style=\"width:100px; font-size:14px\" name=\"contraact\"></input></td></tr><tr><td>?</td></tr><tr><td align=\"center\" colspan=\"2\"><input type=\"button\" class=\"boton_3d_big\" name=\"continuar\" id=\"bot_contra\" value=\" Continuar \" onClick=\"Botones('continuar');\" onmouseover=\"turnOn(this);\" onmouseout=\"turnOff(this);\" title=\" Continuar \"></input></td></tr><tr><td>?</td></tr><tr><td align=\"center\" colspan=\"2\"><font style=\"font-size: 14px; font-weight:bold; color:red\"><xsl:value-of select=\"linea-msg\"></xsl:value-of></font></td></tr><tr><td>?</td></tr><tr><td>?</td></tr><tr><td align=\"center\" colspan=\"2\"><font style=\"font-size: 11px;\">P?ginas optimizadas para una resolucin de 1024x768</font></td></tr></table></td></tr></table></td></tr></table></xsl:template><xsl:include href=\"hoscabe1.xsl\"></xsl:include></xsl:stylesheet>\n";
2411:
2412: String lExpectation = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
2413: + "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\"><xsl:output method=\"html\" encoding=\"ISO-8859-1\"/><xsl:template match=\"/\"><html id=\"\"><head id=\"\"><script language=\"javascript\" src=\"abysal.js\"></script><script language=\"javascript\" src=\"hospeweb.js\"></script><title>D.G.P. - Partes de viajeros identificacin</title><link type=\"text/css\" href=\"http://rajanagendra.sun.com/Base/Raja/recursos/dgpgene.css\" rel=\"stylesheet\"/><link type=\"text/css\" href=\"http://rajanagendra.sun.com/Base/Raja/recursos/dgphospe.css\" rel=\"stylesheet\"/><meta charset=\"iso-8859-1\" http-equiv=\"Context-Type\" content=\"text/html\"/><script language=\"javascript\">//\n"
2414: + "function Inicializar ()\n"
2415: + "{\n"
2416: + " putFocus('usuario');\n"
2417: + "}\n"
2418: + "\n"
2419: + "function Botones (tipo)\n"
2420: + "{\n"
2421: + " if (tipo == 'continuar')\n"
2422: + " {\n"
2423: + " if (isBlankOrNull(document.getElementById('usuario')))\n"
2424: + " alert ('Debe indicar usuario');\n"
2425: + " else\n"
2426: + " if (isBlankOrNull(document.getElementById('claveact')))\n"
2427: + " alert ('Debe indicar su clave');\n"
2428: + " else\n"
2429: + " if (isBlankOrNull(document.getElementById('contraact')))\n"
2430: + " alert ('Debe indicar su contrase?a');\n"
2431: + " else\n"
2432: + " {\n"
2433: + " var lista =\n"
2434: + " new Array('abysal_debug','0',\n"
2435: + " 'abysal_user', document.getElementById('usuario').value,\n"
2436: + " 'usuario', document.getElementById('usuario').value,\n"
2437: + " 'claveact', document.getElementById('claveact').value,\n"
2438: + " 'contraact', document.getElementById('contraact').value);\n"
2439: + " DoCallSec('hospwin1',lista);\n"
2440: + " }\n"
2441: + " }\n"
2442: + " else\n"
2443: + " {\n"
2444: + " alert ('Opcin no implementada');\n"
2445: + " }\n"
2446: + "\n"
2447: + "}\n"
2448: + "\n"
2449: + "function TeclaPulsada( eventoPulsaTecla )\n"
2450: + "{\n"
2451: + " bc = new browser_check;\n"
2452: + " if (bc.ns6)\n"
2453: + " tecla = eventoPulsaTecla.which;\n"
2454: + " else\n"
2455: + " if (bc.ie)\n"
2456: + " tecla = window.event.keyCode;\n"
2457: + " if (tecla == 13)\n"
2458: + " {\n"
2459: + " Botones('continuar');\n"
2460: + " }\n"
2461: + "}\n"
2462: + "\n"
2463: + "\n"
2464: + "document.onkeypress = TeclaPulsada;</script></head><body id=\"consultas\" onload=\"DoInit(); Inicializar()\" style=\"font-family:verdana, arial; margin:1px; margin-top:0px; background-color: #C9D7F2;\"><xsl:apply-templates></xsl:apply-templates></body></html></xsl:template><xsl:template match=\"root\"><form action=\"abysal\" method=\"post\"><input type=\"hidden\" name=\"abysal_program\" value=\"{abysal_program}\"></input><input type=\"hidden\" name=\"abysal_command\" value=\"{abysal_command}\"></input><img id=\"ack\" name=\"ack\" style=\"display:none\"></img></form><input type=\"hidden\" id=\"apliaux\" name=\"apliaux\" value=\"{aplicacion}\"></input><table cellspacing=\"0\" cellpadding=\"0\" id=\"tablaPadre\" border=\"0\" align=\"left\" height=\"100%\"><xsl:call-template name=\"cab-hos-sinfecha\"></xsl:call-template><tr><xsl:call-template name=\"margen-izda\"></xsl:call-template><td><table style=\"background-image: url(recursos/hosp-tapiz.gif);background-repeat: no-repeat;background-position: center center\" border=\"0\" align=\"center\" height=\"100%\"><tr><td valign=\"top\"><table border=\"0\" width=\"100%\" id=\"contenido\"><tr><td>?</td></tr><tr><td>?</td></tr><tr><td align=\"center\" colspan=\"2\"><font style=\"font-size: 24px; font-weight:bold; color:#104a7b\">CONTROL DE ACCESOS</font></td></tr><tr><td>?</td></tr><tr><td>?</td></tr><tr><td align=\"right\"><font style=\"font-size: 14px; font-weight:bold; color:#104a7b\">Usuario?</font></td><td align=\"left\"><input TYPE=\"text\" id=\"usuario\" value=\"{usuario}\" maxlength=\"10\" tabindex=\"1\" onkeypress=\"autinput(this,true,true)\" style=\"width:100px; font-size:14px\" name=\"usuario\"></input></td></tr><tr><td align=\"right\"><font style=\"font-size: 14px; font-weight:bold; color:#104a7b\">Clave?</font></td><td align=\"left\"><input TYPE=\"password\" id=\"claveact\" value=\"{claveact}\" maxlength=\"8\" tabindex=\"2\" onkeypress=\"autinput(this,true,false)\" style=\"width:100px; font-size:14px\" name=\"claveact\"></input></td></tr><tr><td align=\"right\"><font style=\"font-size: 14px; font-weight:bold; color:#104a7b\">Contrase?a?</font></td><td align=\"left\"><input TYPE=\"password\" id=\"contraact\" value=\"{contraact}\" maxlength=\"8\" tabindex=\"3\" onkeypress=\"autinput(this,true,false)\" style=\"width:100px; font-size:14px\" name=\"contraact\"></input></td></tr><tr><td>?</td></tr><tr><td align=\"center\" colspan=\"2\"><input type=\"button\" class=\"boton_3d_big\" name=\"continuar\" id=\"bot_contra\" value=\" Continuar \" onClick=\"Botones('continuar');\" onmouseover=\"turnOn(this);\" onmouseout=\"turnOff(this);\" title=\" Continuar \"></input></td></tr><tr><td>?</td></tr><tr><td align=\"center\" colspan=\"2\"><font style=\"font-size: 14px; font-weight:bold; color:red\"><xsl:value-of select=\"linea-msg\"></xsl:value-of></font></td></tr><tr><td>?</td></tr><tr><td>?</td></tr><tr><td align=\"center\" colspan=\"2\"><font style=\"font-size: 11px;\">P?ginas optimizadas para una resolucin de 1024x768</font></td></tr></table></td></tr></table></td></tr></table></xsl:template><xsl:include href=\"http://rajanagendra.sun.com/Base/Raja/hoscabe1.xsl\"></xsl:include></xsl:stylesheet>";
2465:
2466: String[] lXMLAttRules = {
2467: "<Attribute name=\"href\"/>",
2468: "<Attribute name=\"href\" tag='*'/>",
2469: "<Attribute name=\"href\" tag='xml-stylesheet;xsl:include;link'/>",
2470: "<Attribute name=\"href\" tag='xml-stylesheet;xsl:i*nclude;l*'/>",
2471: "<Attribute name=\"href\" tag='xsl:stylesheet;xsl:in*ude;li*k'/>", };
2472:
2473: for (int i = 0; i < lXMLAttRules.length; i++) {
2474: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
2475: lXMLAttRules[i], "");
2476: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2477: LanguageConstants.XML_MIME);
2478: String lResult = lRewriter.rewrite(lInput,
2479: getDefaultTranslator());
2480: assertXMLEqual("For i=" + i, lExpectation, lResult);
2481: }
2482: }//testIncludeHREFInXSL1()
2483:
2484: public void testStylesheetPI() throws Exception {
2485: String lInput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
2486: + "<?xml-stylesheet type=\"text/xsl\" href=\"hosmmin1.xsl\"?>\n"
2487: + "<root>\n" + "</root>\n";
2488: String lExpectation = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
2489: + "<?xml-stylesheet type=\"text/xsl\" href=\"http://rajanagendra.sun.com/Base/Raja/hosmmin1.xsl\"?>\n"
2490: + "<root>\n" + "</root>";
2491:
2492: String[] lXMLAttRules = { "<Attribute name=\"href\"/>",
2493: "<Attribute name=\"href\" tag='*'/>",
2494: "<Attribute name=\"href\" tag='xml-stylesheet'/>", };
2495:
2496: for (int i = 0; i < lXMLAttRules.length; i++) {
2497: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
2498: lXMLAttRules[i], "");
2499: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2500: LanguageConstants.XML_MIME);
2501: String lResult = lRewriter.rewrite(lInput,
2502: getDefaultTranslator());
2503: assertXMLEqual(lExpectation, lResult);
2504: }
2505: }//testStylesheetPI
2506:
2507: public void testStylesheetPINegative() throws Exception {
2508: String lInput = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
2509: + "<?xml-stylesheet type=\"text/xsl\" href=\"#hosmmin1\"?>\n"
2510: + "<root>\n" + "</root>\n";
2511:
2512: String[] lXMLAttRules = { "<Attribute name=\"href\"/>",
2513: "<Attribute name=\"href\" tag='*'/>",
2514: "<Attribute name=\"href\" tag='xml-stylesheet'/>", };
2515:
2516: for (int i = 0; i < lXMLAttRules.length; i++) {
2517: RuleSet lRuleSet = CreateRuleSet.withXMLAttTagTextRules(
2518: lXMLAttRules[i], "");
2519: Rewriter lRewriter = RewriterPool.create(lRuleSet,
2520: LanguageConstants.XML_MIME);
2521: String lResult = lRewriter.rewrite(lInput,
2522: getDefaultTranslator());
2523: assertXMLEqual(lInput, lResult);
2524: }
2525: }//testStylesheetPINegative
2526:
2527: public static void main(String[] args) {
2528: RewriterModule.initFile();
2529: BasicTestCase.run(TestXMLAttributes.class);
2530:
2531: TestSuite testSuite = new TestSuite();
2532: testSuite.addTest(new TestXMLAttributes(
2533: "testSingleQuotAttributes"));
2534: //BasicTestCase.run( testSuite );
2535: }//main()
2536:
2537: }//class TestXMLAttributes
|