<commit_before>/*
 * $Id$
 * $Revision$ $Date$
 * 
 * ==============================================================================
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package wicket.markup.transformer;

import wicket.Component;
import wicket.markup.ComponentTag;

/**
 * An IBehavior which can be added to any component. It allows to post-process
 * (XSLT) the markup generated by the component. The *.xsl resource must be
 * located in the same path as the nearest parent with an associated markup and
 * must have a filename equal to the component's id.
 * <p>
 * The containers tag will be the root element of the xml data applied for
 * transformation to ensure the xml data are well formed (single root element).
 * In addition the attribute
 * <code>xmlns:wicket="http://wicket.sourceforge.net"</code> is added to the
 * root element to allow the XSL processor to handle the wicket namespace.
 * 
 * @see wicket.markup.transformer.AbstractOutputTransformerContainer
 * @see wicket.markup.transformer.XsltOutputTransformerContainer
 * 
 * @author <NAME>
 */
public class XsltTransfomerBehavior extends AbstractTransformerBehavior
{
	private static final long serialVersionUID = 1L;

	/**
	 * Construct.
	 */
	public XsltTransfomerBehavior()
	{
	}

	/**
	 * @see wicket.behavior.IBehavior#onComponentTag(wicket.Component,
	 *      wicket.markup.ComponentTag)
	 */
	public void onComponentTag(final Component component, final ComponentTag tag)
	{
		tag.put("xmlns:wicket", "http://wicket.sourceforge.net");
		
		// Make the XSLT processor happy and allow him to handle the wicket
		// tags and attributes which are in the wicket namespace
		super.onComponentTag(component, tag);
	}
	
	/**
	 * 
	 * @see wicket.markup.transformer.ITransformer#transform(wicket.Component,
	 *      java.lang.String)
	 */
	public CharSequence transform(final Component component, final String output) throws Exception
	{
		return new XsltTransformer().transform(component, output);
	}
}<commit_msg>javadoc<commit_after>/*
 * $Id$
 * $Revision$ $Date$
 * 
 * ==============================================================================
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package wicket.markup.transformer;

import wicket.Component;
import wicket.markup.ComponentTag;

/**
 * An IBehavior which can be added to any component except ListView. It allows
 * to post-process (XSLT) the markup generated by the component. The *.xsl
 * resource must be located in the same path as the nearest parent with an
 * associated markup and must have a filename equal to the component's id.
 * <p>
 * The containers tag will be the root element of the xml data applied for
 * transformation to ensure the xml data are well formed (single root element).
 * In addition the attribute
 * <code>xmlns:wicket="http://wicket.sourceforge.net"</code> is added to the
 * root element to allow the XSL processor to handle the wicket namespace.
 * <p>
 * The reason why the transformer can not be used to XSLT the ListViews output
 * is because of the ListViews markup being reused for each ListItem. Please use
 * a XsltOutputTransformerContainer instead. Note: if the ListView is used to
 * print a list of &lt;tr&gt; tags, than the transformer container must enclose
 * the &lt;table&gt; tag as well to be HTML compliant.
 * 
 * @see wicket.markup.transformer.AbstractOutputTransformerContainer
 * @see wicket.markup.transformer.XsltOutputTransformerContainer
 * 
 * @author <NAME>
 */
public class XsltTransfomerBehavior extends AbstractTransformerBehavior
{
	private static final long serialVersionUID = 1L;

	/**
	 * Construct.
	 */
	public XsltTransfomerBehavior()
	{
	}

	/**
	 * @see wicket.behavior.IBehavior#onComponentTag(wicket.Component,
	 *      wicket.markup.ComponentTag)
	 */
	public void onComponentTag(final Component component, final ComponentTag tag)
	{
		tag.put("xmlns:wicket", "http://wicket.sourceforge.net");

		// Make the XSLT processor happy and allow him to handle the wicket
		// tags and attributes which are in the wicket namespace
		super.onComponentTag(component, tag);
	}

	/**
	 * 
	 * @see wicket.markup.transformer.ITransformer#transform(wicket.Component,
	 *      java.lang.String)
	 */
	public CharSequence transform(final Component component, final String output) throws Exception
	{
		return new XsltTransformer().transform(component, output);
	}
}
{'fraction_non_alphanumeric': 0.11139944392956441, 'fraction_numerical': 0.0018535681186283596, 'mean_word_length': 4.228682170542636, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2405612', 'n_tokens_mistral': 1523, 'n_tokens_neox': 1429, 'n_words': 575}