Hot answers tagged

15

One of the last ones I used was for 2011 and it stripped out a lot of unwanted elements and attributes (in the hope to the keep the source clear most of the times ;o). It's documented what does what, hope its helpful to you: <stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0"> <output omit-xml-declaration="yes" method="xml" ...


12

The problem is indeed "an error in the if". You have used the XPath 'contains' function, which returns a boolean, and then compared it with a string (either 'true' or 'false'). In the case of comparing a boolean to a string, the string is converted to a boolean. The rules for this conversion are that a non-empty string is true, and an empty string is false,...


9

As for the XSLT required, try using the following Filtering XSLT <stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0"> <output omit-xml-declaration="yes" method="xml" cdata-section-elements="script"></output> <template match="/ | node() | @*"> <copy> <apply-templates select="node() | @*">&...


8

You should better follow my XSLT, since the way you declared is not the right approach. <xsl:if test="document(@xlink:href)/tcm:Component/tcm:Data/tcm:IsExternalMultimediaFile = 'true'"> <xsl:choose> <xsl:when test="contains(document(@xlink:href)/tcm:Component/tcm:Data/tcm:MultimediaFilename, '&amp;+_+=') = 'false'...


5

In order to remove the namespace from the <p> element, all you have to do is apply a blank namespace attribute. The final (correct) filtering XSLT is the same as the original except for this line: <element name="p" namespace=""> Once I applied this change, I was able to get the correct output: <p>Test</p>


5

After some digging, I decided to make a C# TBB to add the missing property as follows: Item outputItem = package.GetByName("Output"); outputItem.Properties["BaseTCMURI"] = engine.PublishingContext.ResolvedItem.Template.Id; package.PushItem("Output", outputItem ); After adding this between the XSLT TBB and the Extract Binaries TBB, everything works fine. ...


5

based on: https://stackoverflow.com/questions/4845660/xsl-how-to-split-strings <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:tridion="http://www.xyz.com/tridion/schemas"> <xsl:output method="xml" encoding="utf-8" indent="no"/> <xsl:template match="tridion:Office/tridion:Telephone/text()" name="split"&...


4

This is now working. The fix was... Had to add span to new-inline-tags in %TRIDION_HOME%\WebUI\Core\Controls\FormatArea\TcmXhtml\TcmXHTML.config for this to work. If the element I am adding is not present in this config file under new-inline tags then the XSLT will fail and not apply the template.


4

Extract binaries from HTML It checks the Output item in the input package (containing HTML or XHTML) for references to Multimedia Components in the form of file names with relative paths. It retrieves the binary content of those Multimedia Components and adds them as binary streams to the package, and it replaces the filename references with TCM URI ...


4

You may try to put 'exclude-result-prefixes' in stylesheet header. There are so many links with explanation how to do this. I just picked up one as example. https://stackoverflow.com/questions/827600/how-can-i-prevent-these-redundant-namespaces-from-an-xslt-stylesheet


4

Consider matching on just the img/@href as well as using variables to help manage this requirement, especially if you're already using an "identity" XSLT approach. Dominic's example helps clarify how XSLT handles string and boolean comparisons; XSL variables can help isolate, test, and mange your logic. Siva shows how to simplify writing out the XML nodes ...


4

Bart answer was the one you need to use. You need to include the default tridion template part (that is first 3 templates) and then you need to add your required template match. <stylesheet xmlns="http://www.w3.org/1999/XSL/Transform" version="1.0"> <output omit-xml-declaration="yes" method="xml" cdata-section-elements="script"/> <...


4

When Tridion executes the XSLT of an RTF, it does a couple of things you should be aware of. Firstly, it strips out the XHTML namespace, putting the XML of the RTF into "no namespace", (or if you prefer, the namespace whose URI is an empty string.). It then takes the XML fragment and wraps it in a tag. (I'm a bit vague on this... it's not documented - maybe ...


4

The document() function will almost certainly cache the result, so if you call it twice, supplying the same URI, then the document will not be re-read and re-parsed on the second and subsequent occasions. Your custom function is not maintaining a similar cache.


3

I don't think you need to add namespace while creating span tag, try removing namespace. SPAN is a valid tag and it's not required to add on new-inline-tags Update: While going through your XSLT, I see that you have written a template which can match for any element and it tries to create a href attribute which looks for @href attribute. But actually, ...


3

Add this XSLT match at the bottom of the Filtering XSLT <template match="a"> <choose> <when test="contains(@class, &apos;cta-button-secondary&apos;)"> <copy> <apply-templates select="node() | @*"></apply-templates> </copy> <attribute name="...


3

Finally I solved the problem pasting from a new schema in SDL Tridion 2011 the "tcm:FilterXSLT..." node in the old schema's source (because it was the only part of the schema where I could edit the xsl). After that, when I pressed the Rich Text Formatting Features, the pop up window opened with no problems and I could finally edit the Xslt filter, and the ...


3

We had similar issues after migration, if you are using any custom XSLT for that particular RTF fields. You have to either replace with new XSLT of 2011 or Merge old and new XSLT. also check this StackExchange link for more details


3

You need to include new tags for new-inline-tags on TcmXHTML.config file Location: %TRIDION_HOME%\WebUI\Core\Controls\FormatArea\TcmXhtml\TcmXHTML.config Example: new-inline-tags: iframe XYZ ABC PQR Update: Try replacing this <template match="a"> <iframe src="http://www.google.com"></iframe> <text>The link should have ...


3

The wording of your question suggests to me that you're mixing concepts... The XSLT filter in a schema is meant to change the content you store in that field not the output of that component. As such, the XSLT filter is applied to content when you save it, not when you publish it. If you want to change the field content on publish then you should be working ...


3

As Chris points out, your XSL elements are missing the prefix. I think he's right to think this is a migration problem. What this means is that when you're creating the div, the namespace is that of XSL. To fix this, I'd suggest returning to the more normal situation, where XSL elements use a prefix to reference their namespace, and set the default ...


3

This is indeed a generic XML/XSLT question and not specific to Tridion. But here's how I would write it (having not seen the rest of your XSLT and ignoring the $nSpace part): <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" encoding="utf-8" indent="yes"/> <xsl:template match="p[...


2

Try writing <xhtml:div class="video-container">.... instead of creating the element. Not sure it will make a difference


2

The XSLT mediator was created for SDL Tridion R5.3 up until 2011, since in SDL Tridion 2013, a new Template Building Block type was added, the XSLT template. That was done by adding the XSLT mediator to the release basically, rendering the mentioned extension void. So you should NOT try to install the XSLT mediator extension, just use the built in one ...


2

With the disclaimer of not having tried it, this is what I suggest: Declare an xhtml namespace in your stylesheet: xmlns:xhtml="http://www.w3.org/1999/xhtml" Declare to exclude namespace prefix xhtml from result: exclude-result-prefixes="xhtml" Finally, create your p element belonging to the xhtml namespace: <element name="p" namespace="xhtml">


2

Even though Bjorn's answer seems hypothetical, it is almost completely correct. :-) In general, so-called templating function sources (.NET classes which are exposing their methods to modular templates) are exposed in the XSLT mediator as extension functions in XML namespaces named as: http://www.sdltridion.com/ContentManager/FunctionSource/<...


2

You will need to invoke the (globally available) function RenderComponentPresentation as explained here. The builtin functions are found in Tridion.ContentManager.Templating.Expression.BuiltInFunctions but I have no idea if SDL attributed them with an XSLT namespace... Assuming they did and that namespace was "http://www.sdltridion.com/ContentManager/...


2

You need something like this: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" omit-xml-declaration="yes"/> <xsl:template match="/"> <tr> <xsl:text disable-output-escaping="yes">&lt;</xsl:text> td <xsl:value-of select="...


2

This is not caused by the XSLT, but rather by Tidy, which is also executed when an RTF is updated. The RTF content is wrapped in a <body/> tag before processing, so Tidy will remove anything that doesn't belong in the body of an html page. In your case, html and link elements don't belong in the body, so they are stripped. That only leaves the ...


2

The Tridion RTF XSLT formats HTML to XHTML, therefore updating the empty <div> tag to be a self closing tag. See questions like https://stackoverflow.com/questions/10537656/creating-anchor-links-in-rich-text-fields-with-sdl-tridion-2011-sp1 for examples of how to resolve this using an embedded span tag You will need something like <template match=...


Only top voted, non community-wiki answers of a minimum length are eligible