I am new to livesite i am trying how we can fetch value from replicant datumn in appearence xsl .Pls give suggestions
Generally, you'll want to use an <xsl:for-each> or <xsl:apply-templates> to iterate over the replicant instances (the <Group> elements), and then use context-relative xpaths within. Or you can access specific instances via [3]-type queries in your xpath.
Post your component xml if you want an actual example.
Hi ,
Thanks for your valued response .Here is my code snippet that I am trying to work out :
<Data> <Group ID="G1" Name="Headline" Replicatable="true"><Datum ID="D1" Type="String" Name="subHeadlines1" Replicatable="true">example one</Datum></Group><Datum ID="D2" Type="String" Name="subHeadlines2" Replicatable="true">example two</Datum></Data>
In this i am trying have made single datumn replicable , group replicable and datumn inside group also replicable.
Thanks
<xsl:for-each select="/Properties/Data/Group[@Name='Headline']"> <h2><xsl:value-of select="./Datum[@Name='subHeadlines1']" /></h2></xsl:for-each><!-- or --><xsl:template match="Group[@Name='Headline']"> <h2><xsl:value-of select="./Datum[@Name='subHeadlines1']" /></h2></xsl:template><xsl:template match="/"> <!-- ... ---> <xsl:apply-templates select="/Properties/Data/Group[@Name='Headline']" /> <!-- ... --></xsl:template>
Note, nested replicants aren't supported in SitePub; that's explicitly stated in the dev guide. It's not going to work.
Most people use DCRs rather than datums for any data that is not truly simple, i.e. 1 text field.
Thanks a lot friend it worked out.
it worked out ...
You want to fetch the value of replicatable datum and testing data is :
so i am attaching the code snippit for two cases (including yours) :
Case 1 : Group and Datum inside Group are replicatable, you can use below syntax to fetch the values
<xsl:for-each select="Properties/Data/Group"> <xsl:for-each select="Datum"> <xsl:variable name="pos" select="position()"/> <xsl:value-of select="../Datum[$pos]"/> <br/> </xsl:for-each></xsl:for-each>
Case 2 : Group and Datum (Parallel to Group) are replicatable, you can use below syntax to fetch the values
<xsl:for-each select="Properties/Data/Datum"> <xsl:variable name="pos" select="position()"/> <xsl:value-of select="../Datum[$pos]"/> <br/></xsl:for-each>