How to get the name, version, identifier of the tcm component in XSLT TBB

I am working on XSLT template building blocks in SDL Tridion 2011 SP1 using the XSLT mediator.

I just wanted to know how to get the component name, version, and its TCMID during rendering.

Can anyone help how this can be done?

+4
source share
3 answers

After clearly observing the output in the template builder, I got an answer like

<xsl:element name="TCMID"> <xsl:value-of select="tcm:Component/@ID"/> </xsl:element> <xsl:element name="name"> <xsl:value-of select="tcm:Component/tcm:Data/tcm:Title"/> </xsl:element> <xsl:element name="Version"> <xsl:value-of select="tcm:Component/tcm:Info/tcm:VersionInfo/tcm:Version"/> </xsl:element> 
+7
source

Probably not the complete answer to your question, but package elements should be available as arguments to the template. Therefore, if you need to access a value that is not in Component XML, you can add it to the package before running XSLT TBB.

+4
source

Access to non-informational values โ€‹โ€‹for a component is invoked by many developers. This is not surprising since there is no obvious way to view the complete XML component of a component from the user interface. The source tab in the CME (SDL Tridion CM user interface) shows only the XML content of the node in XML and does not display the full XML.

To see the full XML (without loading it through the API), you have several options. Starting with the simplest ones:

  • Use XSLT to write the root of the node component, using something like <xsl:copy-of select="."/> . This will write the entire XML component to the output of the template, which can then be saved for reference when writing XSLT.
  • Access the XML component using the protocol handler on the CMS server by typing the URI in Internet Explorer and it should display the full XML.
  • Install SDL Tridion PowerTools , which set a tab in the representations of elements that display XML.

Once you can access XML, it becomes very intuitive to find any property of any Tridion object.

+1
source

Source: https://habr.com/ru/post/1412316/


All Articles