Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/org.eclipse.jet.doc/references/taglibs/formatTags/overview.html7
-rw-r--r--doc/org.eclipse.jet.doc/references/taglibs/formatTags/xpathTag.html74
-rw-r--r--doc/org.eclipse.jet.doc/tocformatTags.xml1
-rw-r--r--plugins/org.eclipse.jet/Generate Taglib Docs - org.eclipse.jet (plugin.xml).launch3
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/control/TagFactory.java6
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/TagFactory.java11
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/XPathTag.java61
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/java/TagFactory.java6
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/workspace/TagFactory.java6
-rw-r--r--plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.taglibdoc_1.0.0.jarbin36851 -> 36817 bytes
-rw-r--r--transforms/org.eclipse.jet.transforms.tagfactory/.settings/org.eclipse.core.resources.prefs2
-rw-r--r--transforms/org.eclipse.jet.transforms.tagfactory/templates/tagLibrary/tagFactory.java.jet6
-rw-r--r--transforms/org.eclipse.jet.transforms.taglibdoc/templates/control.jet6
13 files changed, 159 insertions, 30 deletions
diff --git a/doc/org.eclipse.jet.doc/references/taglibs/formatTags/overview.html b/doc/org.eclipse.jet.doc/references/taglibs/formatTags/overview.html
index 986a5f3..0103933 100644
--- a/doc/org.eclipse.jet.doc/references/taglibs/formatTags/overview.html
+++ b/doc/org.eclipse.jet.doc/references/taglibs/formatTags/overview.html
@@ -80,6 +80,13 @@
<!-- End uuid description -->
</TD>
</TR>
+ <TR>
+ <TD width="10%"><A href="xpathTag.html">&lt;f:xpath&gt;</A></TD>
+ <TD><!-- Begin xpath description -->
+ <P> Evaluate the specified XPath function on the tag content and write the result in place of the tag content
+ <!-- End xpath description -->
+ </TD>
+ </TR>
</TBODY>
</TABLE>
<HR>
diff --git a/doc/org.eclipse.jet.doc/references/taglibs/formatTags/xpathTag.html b/doc/org.eclipse.jet.doc/references/taglibs/formatTags/xpathTag.html
new file mode 100644
index 0000000..1d569b5
--- /dev/null
+++ b/doc/org.eclipse.jet.doc/references/taglibs/formatTags/xpathTag.html
@@ -0,0 +1,74 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<HTML>
+<HEAD>
+<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<META name="GENERATOR" content="IBM Software Development Platform">
+<link rel="STYLESHEET" href="../../../book.css" charset="ISO-8859-1" type="text/css"/>
+<TITLE>&lt;f:xpath&gt; - Standard JET2 Format Tags</TITLE>
+</HEAD>
+<BODY>
+<TABLE border="0" cellpadding="0" cellspacing="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH align="left">
+ <P>&lt;f:xpath&gt;</P></TH>
+ <TH align="right"><A href="overview.html">Standard JET2 Format Tags</A></TH>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<P><B>xpath</B></P>
+<P><P> Evaluate the specified XPath function on the tag content and write the result in place of the tag content. The tag content is referenced by the variable $bodyContent.<P> </P>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Tag Summary</TH></TR>
+ <TR>
+ <TD width="10%">required</TD>
+ <TD><SPAN style="font-family: monospace">
+ &lt;f:xpath select=&quot;<I>value</I>&quot;&gt;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;<I>content consumed by tag evaluation</I><BR>
+ &lt;/f:xpath&gt;
+ </SPAN></TD>
+ </TR>
+ <TR>
+ <TD width="10%">full tag</TD>
+ <TD><SPAN style="font-family: monospace">
+ &lt;f:xpath select=&quot;<I>value</I>&quot;&gt;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;<I>content consumed by tag evaluation</I><BR>
+ &lt;/f:xpath&gt;
+ </SPAN></TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Required Attributes</TH></TR>
+ <TR>
+ <TD width="10%">select</TD>
+ <TD><BR> The XPath expression to evaluate. The result is automatically converted to a a string. The tags content is refered to by the variable $bodyContent.<BR> </TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<HR>
+<TABLE border="1" width="100%">
+ <TBODY>
+ <TR>
+ <TH colspan="2" align="left">Example</TH></TR>
+ <TR>
+ <TD width="10%"></TD>
+ <TD><SPAN style="font-family: monospace">
+<!-- Begin xpath example -->
+ &lt;f:xpath select=&quot;normalize-space($bodyContent)&quot;&gt;<br>
+ &nbsp;&nbsp;&nbsp;&nbsp;My content with <BR> lots of whitespace</I><BR>
+ &lt;/f:xpath&gt;<BR>
+<!-- End xpath example -->
+</SPAN></TD>
+ </TR>
+ </TBODY>
+</TABLE>
+<P></P></BODY>
+</HTML>
diff --git a/doc/org.eclipse.jet.doc/tocformatTags.xml b/doc/org.eclipse.jet.doc/tocformatTags.xml
index 0e70708..9ce4fb9 100644
--- a/doc/org.eclipse.jet.doc/tocformatTags.xml
+++ b/doc/org.eclipse.jet.doc/tocformatTags.xml
@@ -11,5 +11,6 @@
<topic label="f:uc" href="references/taglibs/formatTags/ucTag.html"/>
<topic label="f:unique" href="references/taglibs/formatTags/uniqueTag.html"/>
<topic label="f:uuid" href="references/taglibs/formatTags/uuidTag.html"/>
+ <topic label="f:xpath" href="references/taglibs/formatTags/xpathTag.html"/>
</topic>
</toc>
diff --git a/plugins/org.eclipse.jet/Generate Taglib Docs - org.eclipse.jet (plugin.xml).launch b/plugins/org.eclipse.jet/Generate Taglib Docs - org.eclipse.jet (plugin.xml).launch
index cfb5816..d1f1ed1 100644
--- a/plugins/org.eclipse.jet/Generate Taglib Docs - org.eclipse.jet (plugin.xml).launch
+++ b/plugins/org.eclipse.jet/Generate Taglib Docs - org.eclipse.jet (plugin.xml).launch
@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jet.jet2Transformation">
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+</listAttribute>
<stringAttribute key="org.eclipse.jet.id" value="org.eclipse.jet.transforms.taglibdoc"/>
<intAttribute key="org.eclipse.jet.logFilterLevel" value="3"/>
<stringAttribute key="org.eclipse.jet.source" value="org.eclipse.jet/plugin.xml"/>
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/control/TagFactory.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/control/TagFactory.java
index d83c47c..fcdc617 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/control/TagFactory.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/control/TagFactory.java
@@ -1,7 +1,6 @@
/**
- * <copyright>
*
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,9 +9,6 @@
* Contributors:
* IBM - Initial API and implementation
*
- * </copyright>
- *
- * $Id: TagFactory.java,v 1.1 2007/11/29 21:37:48 pelder Exp $
*/
package org.eclipse.jet.internal.taglib.control;
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/TagFactory.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/TagFactory.java
index f3ce582..b7e64f3 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/TagFactory.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/TagFactory.java
@@ -1,7 +1,6 @@
/**
- * <copyright>
*
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,9 +9,6 @@
* Contributors:
* IBM - Initial API and implementation
*
- * </copyright>
- *
- * $Id: TagFactory.java,v 1.1 2007/11/29 21:37:48 pelder Exp $
*/
package org.eclipse.jet.internal.taglib.format;
@@ -36,7 +32,7 @@ public class TagFactory implements TagInstanceFactory
*/
public TagFactory()
{
- tagOrdinalByName = new HashMap(8);
+ tagOrdinalByName = new HashMap(9);
tagOrdinalByName.put("formatNow",new Integer(1)); //$NON-NLS-1$
tagOrdinalByName.put("lc",new Integer(2)); //$NON-NLS-1$
@@ -46,6 +42,7 @@ public class TagFactory implements TagInstanceFactory
tagOrdinalByName.put("uc",new Integer(6)); //$NON-NLS-1$
tagOrdinalByName.put("unique",new Integer(7)); //$NON-NLS-1$
tagOrdinalByName.put("uuid",new Integer(8)); //$NON-NLS-1$
+ tagOrdinalByName.put("xpath",new Integer(9)); //$NON-NLS-1$
}
public CustomTag createCustomTag(String name)
@@ -69,6 +66,8 @@ public class TagFactory implements TagInstanceFactory
return new org.eclipse.jet.internal.taglib.format.UniqueTag();
case 8: // uuid
return new org.eclipse.jet.internal.taglib.format.UuidTag();
+ case 9: // xpath
+ return new org.eclipse.jet.internal.taglib.format.XPathTag();
default:
throw new JET2TagException("Unknown Tag: " + name); //$NON-NLS-1$
}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/XPathTag.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/XPathTag.java
new file mode 100644
index 0000000..cc0439e
--- /dev/null
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/format/XPathTag.java
@@ -0,0 +1,61 @@
+/**
+ * <copyright>
+ *
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *
+ * </copyright>
+ *
+ * $Id: XPathTag.java,v 1.1 2008/04/28 16:45:56 pelder Exp $
+ */
+package org.eclipse.jet.internal.taglib.format;
+
+
+import org.eclipse.jet.JET2Context;
+import org.eclipse.jet.XPathContextExtender;
+import org.eclipse.jet.taglib.AbstractFunctionTag;
+import org.eclipse.jet.taglib.JET2TagException;
+import org.eclipse.jet.taglib.TagInfo;
+
+
+/**
+ * Implement &lt;f:xpath select="<i>expr</i>"&gt;<i>content</i>&lt;/f:xpath&gt;.
+ */
+public class XPathTag extends AbstractFunctionTag
+{
+
+ private static final String VAR_BODY_CONTENT = "bodyContent"; //$NON-NLS-1$
+
+ private static final String ATTR_SELECT = "select"; //$NON-NLS-1$
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jet.taglib.FunctionTag#doFunction(org.eclipse.jet.taglib.TagInfo, org.eclipse.jet.JET2Context, java.lang.String)
+ */
+ public String doFunction(TagInfo td, JET2Context context, String bodyContent) throws JET2TagException
+ {
+ final String xpath = getAttribute(ATTR_SELECT);
+ final Object savedBodyContent = context.hasVariable(VAR_BODY_CONTENT) ? context.getVariable(VAR_BODY_CONTENT) : null;
+
+ try
+ {
+ context.setVariable(VAR_BODY_CONTENT, bodyContent);
+ final XPathContextExtender xce = XPathContextExtender.getInstance(context);
+ final String result = xce.resolveAsString(xce.currentXPathContextObject(), xpath);
+ return result;
+ }
+ finally
+ {
+ if (savedBodyContent != null)
+ {
+ context.setVariable(VAR_BODY_CONTENT, savedBodyContent);
+ }
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/java/TagFactory.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/java/TagFactory.java
index f0e13c2..a0fefa5 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/java/TagFactory.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/java/TagFactory.java
@@ -1,7 +1,6 @@
/**
- * <copyright>
*
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,9 +9,6 @@
* Contributors:
* IBM - Initial API and implementation
*
- * </copyright>
- *
- * $Id: TagFactory.java,v 1.1 2007/11/29 21:37:48 pelder Exp $
*/
package org.eclipse.jet.internal.taglib.java;
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/workspace/TagFactory.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/workspace/TagFactory.java
index e363289..f09e490 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/workspace/TagFactory.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/taglib/workspace/TagFactory.java
@@ -1,7 +1,6 @@
/**
- * <copyright>
*
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,9 +9,6 @@
* Contributors:
* IBM - Initial API and implementation
*
- * </copyright>
- *
- * $Id: TagFactory.java,v 1.1 2007/11/29 21:37:48 pelder Exp $
*/
package org.eclipse.jet.internal.taglib.workspace;
diff --git a/plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.taglibdoc_1.0.0.jar b/plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.taglibdoc_1.0.0.jar
index a24c5b5..dbe8281 100644
--- a/plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.taglibdoc_1.0.0.jar
+++ b/plugins/org.eclipse.jet/transforms/plugins/org.eclipse.jet.transforms.taglibdoc_1.0.0.jar
Binary files differ
diff --git a/transforms/org.eclipse.jet.transforms.tagfactory/.settings/org.eclipse.core.resources.prefs b/transforms/org.eclipse.jet.transforms.tagfactory/.settings/org.eclipse.core.resources.prefs
index fca210c..303a6b7 100644
--- a/transforms/org.eclipse.jet.transforms.tagfactory/.settings/org.eclipse.core.resources.prefs
+++ b/transforms/org.eclipse.jet.transforms.tagfactory/.settings/org.eclipse.core.resources.prefs
@@ -1,4 +1,4 @@
-#Wed Nov 21 09:17:01 EST 2007
+#Sat Apr 26 10:30:38 EDT 2008
eclipse.preferences.version=1
encoding//jet2java/org/eclipse/jet/compiled/_jet_tagFactoryjava.java=UTF-8
encoding//templates/tagLibrary/tagFactory.java.jet=UTF-8
diff --git a/transforms/org.eclipse.jet.transforms.tagfactory/templates/tagLibrary/tagFactory.java.jet b/transforms/org.eclipse.jet.transforms.tagfactory/templates/tagLibrary/tagFactory.java.jet
index b9b7f6f..f5e17fd 100644
--- a/transforms/org.eclipse.jet.transforms.tagfactory/templates/tagLibrary/tagFactory.java.jet
+++ b/transforms/org.eclipse.jet.transforms.tagfactory/templates/tagLibrary/tagFactory.java.jet
@@ -1,7 +1,6 @@
/**
- * <copyright>
*
- * Copyright (c) 2007 IBM Corporation and others.
+ * Copyright (c) <f:formatNow pattern="yyyy"/> IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -10,9 +9,6 @@
* Contributors:
* IBM - Initial API and implementation
*
- * </copyright>
- *
- * $Id: tagFactory.java.jet,v 1.1 2007/11/29 23:20:24 pelder Exp $
*/
package <c:get select="$tagLibrary/@pkgFactory"/>;
diff --git a/transforms/org.eclipse.jet.transforms.taglibdoc/templates/control.jet b/transforms/org.eclipse.jet.transforms.taglibdoc/templates/control.jet
index c6c4ef5..f070e50 100644
--- a/transforms/org.eclipse.jet.transforms.taglibdoc/templates/control.jet
+++ b/transforms/org.eclipse.jet.transforms.taglibdoc/templates/control.jet
@@ -33,7 +33,7 @@
</c:if>
<c:set select="$tagLibrary" name="description">TODO Define description of <c:get select="$tagLibrary/@name"/></c:set>
<c:if test="$tagLibrary/description">
- <c:set select="$tagLibrary" name="description"><f:replaceAll value="\r?\n" replacement="<P>" regex="true"><c:get select="$tagLibrary/description"/></f:replaceAll></c:set>
+ <c:set select="$tagLibrary" name="description"><f:replaceAll value="\\r?\\n" replacement="<P>" regex="true"><c:get select="$tagLibrary/description"/></f:replaceAll></c:set>
</c:if>
--- Iterate over each nested conditionalTag element
@@ -47,14 +47,14 @@
<c:set select="$tag" name="allTagInnards"><c:get select="$tag/@tagQName" /><c:get select="$tag/@requiredAttrs"/><c:get select="$tag/@optionalAttrs"/></c:set>
<c:set select="$tag" name="description">TODO Define description of <c:get select="$tag/@name"/></c:set>
<c:if test="$tag/description">
- <c:set select="$tag" name="description"><f:replaceAll value="\r?\n" replacement="<P>" regex="true"><c:get select="$tag/description"/></f:replaceAll></c:set>
+ <c:set select="$tag" name="description"><f:replaceAll value="\\r?\\n" replacement="<P>" regex="true"><c:get select="$tag/description"/></f:replaceAll></c:set>
</c:if>
--- Iterate over each nested attribute element
<c:iterate select="$tag/attribute" var="attribute">
--- Define additional attributes for the current attribute element
<c:set select="$attribute" name="description">TODO Define description of <c:get select="$attribute/@name"/></c:set>
<c:if test="$attribute/description">
- <c:set select="$attribute" name="description"><f:replaceAll value="\r?\n" replacement="<BR>" regex="true"><c:get select="$attribute/description"/></f:replaceAll></c:set>
+ <c:set select="$attribute" name="description"><f:replaceAll value="\\r?\\n" replacement="<BR>" regex="true"><c:get select="$attribute/description"/></f:replaceAll></c:set>
</c:if>
</c:iterate>
</c:iterate>

Back to the top