Jump to content

Default Hide for nodes


Cu-Ius

Recommended Posts

Hello everyone!I am trying to create a checklist that will drop down content after a category is selected. Similar to how a folder tree works.I have the checklist finshed in XML and the layout looks like the XML below except in some cases there is more then one sub-category (i.e. Sub-category-1, Sub-Category-2, ect, ect) and what i am looking to do is inside the XSL is have each child do a check and if the child's parent is Sub-Category of any kind it needs to be hidden unless a check is placed in the parent checkbox.

Here is the layout for my XML<Checklist>			<Category> 				<Sub-Category> 					<Content name="This is the text that will be next to the checkbox."> 						<Content-Note>							Note About Content goes here						</Content-Note>					</Content>				</Sub-Category>			</Category>		</Checklist>

<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink">      <xsl:template match="/">    <h1>Category</h1>    <ul>      <xsl:apply-templates />    </ul>  </xsl:template>  <xsl:template match="Category">    <ul id="{generate-id(.)}.1">      <input type='checkbox' onclick="togglegroup(this.id)"      id="{generate-id(.)}" />      <xsl:value-of select="@name" disable-output-escaping="yes" />      <xsl:apply-templates />    </ul>  </xsl:template>  <xsl:template match="Sub-Category">    <ul id="{generate-id(.)}.1">      <input type='checkbox' onclick="togglegroup(this.id)"      id="{generate-id(.)}" />      <xsl:value-of select="@name" disable-output-escaping="yes" />      <xsl:apply-templates />    </ul>  </xsl:template>  <xsl:template match="Sub-Category-2">    <ul style="display: block;" id="{generate-id(.)}.1">      <input type='checkbox' onclick="togglegroup(this.id)"      id="{generate-id(.)}" />      <xsl:value-of select="@name" disable-output-escaping="yes" />      <xsl:apply-templates />    </ul>  </xsl:template>  <xsl:template match="Sub-Category-3">    <ul style="display: block;" id="{generate-id(.)}.1">      <input type='checkbox' onclick="togglegroup(this.id)"      id="{generate-id(.)}" />      <xsl:value-of select="@name" disable-output-escaping="yes" />      <xsl:apply-templates />    </ul>  </xsl:template>  <xsl:template match="Content">    <ul style="display: block;" id="{generate-id(.)}.1">      <input type='checkbox' onclick="togglegroup(this.id)"      id="{generate-id(.)}" />      <xsl:value-of select="@name" disable-output-escaping="yes" />      <xsl:apply-templates />    </ul>  </xsl:template> <xsl:template match="Content-Note">    <span id="{generate-id()}" style="display: block;"></span>      <xsl:value-of select="." disable-output-escaping="yes" /> 	  </xsl:template></xsl:stylesheet><!-- this is <Link value =<xsl:template name='links' match="link"><a href="{@value}#{@anchor}">This is what we need to change</a>a href="{@value}"><xsl:value-of select="@lname" /></a><a href="{../@xlink:href}"><xsl:value-of select="."/></a>  </xsl:template>-->

Link to comment
Share on other sites

I found the soultion, for reference the code i used was

<xsl:template match="Content">		<xsl:choose>			<xsl:when test="parent::Sub-Category">				<ul class="box" style="display: block;" id="{generate-id(.)}.1">					<input type="checkbox" onclick="togglegroup(this.id)" id="{generate-id(.)}"/>					<xsl:copy-of select="./CText/node()"/>				<xsl:apply-templates />				</ul>			</xsl:when>	<xsl:otherwise>		<ul class="box" style="display: none;" id="{generate-id(.)}.1">			<input type="checkbox" onclick="togglegroup(this.id)" id="{generate-id(.)}"/>			<xsl:copy-of select="./CText/node()"/>		 <xsl:apply-templates />		</ul>	</xsl:otherwise>		</xsl:choose>	</xsl:template> 

I applied this to Sub-Category as well

Hello everyone!I am trying to create a checklist that will drop down content after a category is selected. Similar to how a folder tree works.I have the checklist finshed in XML and the layout looks like the XML below except in some cases there is more then one sub-category (i.e. Sub-category-1, Sub-Category-2, ect, ect) and what i am looking to do is inside the XSL is have each child do a check and if the child's parent is Sub-Category of any kind it needs to be hidden unless a check is placed in the parent checkbox.
Here is the layout for my XML<Checklist>			<Category> 				<Sub-Category> 					<Content name="This is the text that will be next to the checkbox."> 						<Content-Note>							Note About Content goes here						</Content-Note>					</Content>				</Sub-Category>			</Category>		</Checklist>

<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink">      <xsl:template match="/">    <h1>Category</h1>    <ul>      <xsl:apply-templates />    </ul>  </xsl:template>  <xsl:template match="Category">    <ul id="{generate-id(.)}.1">      <input type='checkbox' onclick="togglegroup(this.id)"      id="{generate-id(.)}" />      <xsl:value-of select="@name" disable-output-escaping="yes" />      <xsl:apply-templates />    </ul>  </xsl:template>  <xsl:template match="Sub-Category">    <ul id="{generate-id(.)}.1">      <input type='checkbox' onclick="togglegroup(this.id)"      id="{generate-id(.)}" />      <xsl:value-of select="@name" disable-output-escaping="yes" />      <xsl:apply-templates />    </ul>  </xsl:template>  <xsl:template match="Sub-Category-2">    <ul style="display: block;" id="{generate-id(.)}.1">      <input type='checkbox' onclick="togglegroup(this.id)"      id="{generate-id(.)}" />      <xsl:value-of select="@name" disable-output-escaping="yes" />      <xsl:apply-templates />    </ul>  </xsl:template>  <xsl:template match="Sub-Category-3">    <ul style="display: block;" id="{generate-id(.)}.1">      <input type='checkbox' onclick="togglegroup(this.id)"      id="{generate-id(.)}" />      <xsl:value-of select="@name" disable-output-escaping="yes" />      <xsl:apply-templates />    </ul>  </xsl:template>  <xsl:template match="Content">    <ul style="display: block;" id="{generate-id(.)}.1">      <input type='checkbox' onclick="togglegroup(this.id)"      id="{generate-id(.)}" />      <xsl:value-of select="@name" disable-output-escaping="yes" />      <xsl:apply-templates />    </ul>  </xsl:template> <xsl:template match="Content-Note">    <span id="{generate-id()}" style="display: block;"></span>      <xsl:value-of select="." disable-output-escaping="yes" /> 	  </xsl:template></xsl:stylesheet><!-- this is <Link value =<xsl:template name='links' match="link"><a href="{@value}#{@anchor}">This is what we need to change</a>a href="{@value}"><xsl:value-of select="@lname" /></a><a href="{../@xlink:href}"><xsl:value-of select="."/></a>  </xsl:template>-->

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...