I am having a problem making an xslt template to pase a small xml file I have.
I am passing the xslt file one parameter. I want to use this parameter to match a node that has the parameter in it then loop through its children.
the xml file looks like this.
<HEADER>
<LINK name="Education">
<TITLE>HighSchool</TITLE>
<URL>/Intrests.aspx</URL>
<TITLE>Bachelors</TITLE>
<URL>/Projects.aspx</URL>
<TITLE>Masters</TITLE>
<URL>/Projects.aspx</URL>
<TITLE>Certifications</TITLE>
<URL>/Projects.aspx</URL>
</LINK>
<LINK name="Home"></LINK>
<LINK name="Interests"></LINK>
<LINK name="Contact"></LINK>
<LINK name="Project"></LINK>
<LINK name="Work"></LINK>
<LINK name="About Site"></LINK>
</HEADER>
I want to use my passed in parameter to match the name attribute of the link node and loop through the TITLE and URL elements within that node.
I was trying something like this without much luck.
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl=" version="1.0">
<xsl:template match="/">
<!-- BUILD Left Menu Bar -->
<xslaram name="LINK" select="Education"></xslaram>
<xsl:for-each select="//HEADER/LINK/@name">
<xsl:if test="@name=$LINK">
<xsl:for-each select="//HEADER/LINK/TITLE">
<a>
<xsl:attribute name="HREF">test<xsl:value-of select="TITLE"/>test</xsl:attribute>
<xsl:value-of select="@name" />
</a>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I know the loops above don't exactly make sense right now because I have been changing them so much but I can't get anything I try to work. I am setting the parameter "LINK" above to Education just for testing purposes.
Any help would be much apreciated.
I am passing the xslt file one parameter. I want to use this parameter to match a node that has the parameter in it then loop through its children.
the xml file looks like this.
<HEADER>
<LINK name="Education">
<TITLE>HighSchool</TITLE>
<URL>/Intrests.aspx</URL>
<TITLE>Bachelors</TITLE>
<URL>/Projects.aspx</URL>
<TITLE>Masters</TITLE>
<URL>/Projects.aspx</URL>
<TITLE>Certifications</TITLE>
<URL>/Projects.aspx</URL>
</LINK>
<LINK name="Home"></LINK>
<LINK name="Interests"></LINK>
<LINK name="Contact"></LINK>
<LINK name="Project"></LINK>
<LINK name="Work"></LINK>
<LINK name="About Site"></LINK>
</HEADER>
I want to use my passed in parameter to match the name attribute of the link node and loop through the TITLE and URL elements within that node.
I was trying something like this without much luck.
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl=" version="1.0">
<xsl:template match="/">
<!-- BUILD Left Menu Bar -->
<xslaram name="LINK" select="Education"></xslaram>
<xsl:for-each select="//HEADER/LINK/@name">
<xsl:if test="@name=$LINK">
<xsl:for-each select="//HEADER/LINK/TITLE">
<a>
<xsl:attribute name="HREF">test<xsl:value-of select="TITLE"/>test</xsl:attribute>
<xsl:value-of select="@name" />
</a>
</xsl:for-each>
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
I know the loops above don't exactly make sense right now because I have been changing them so much but I can't get anything I try to work. I am setting the parameter "LINK" above to Education just for testing purposes.
Any help would be much apreciated.