[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: combination of document() and generate-id() for hy
Hi Julia, > So far so good. What I want to do now is to create hyperlinks from > the base document output (which is called base.xml) to the beginng > of the other documents' output. And I don´t seem to be able to call > the generate-id() -function the right way, although I read the FAQ. I'm a bit confused about what you want as your output, but I think that if you have: <mainApplication name="Demo" configurationPath="product/demo/demoApplication.xml" /> then you want to create an anchor in the template in 'apps' mode, which is currently: > <!-- processes the applications' configuration files--> > <xsl:template match="*[@configurationPath]" mode="apps"> > <xsl:variable name="application" select="@configurationPath"/> > <br/> > <!-- this is were the link should refer to <a>---> > <h2>Application <xsl:value-of select="$application"/></h2> > <!-- </a> --> > <xsl:apply-templates select="document($application)" mode="app"/> > </xsl:template> and a link to that anchor in the template in default mode, which is currently: > <xsl:template match="base:mainApplication"> > <xsl:variable name="test" select="@configurationPath"/> > <tr> > <td>main application</td> > <!-- Here I´d like to have a hyperlink><a>--> > <td><xsl:value-of select="@name"/></td> > <!--</a>--> > <td><xsl:value-of select="@configurationPath"/></td> > </tr> > </xsl:template> For the apps mode template you want to create: <h2> <a name="appID">Application product/demo/demoApplication.xml</a> </h2> while in the default mode template you create a link: <td><a href="#appID">Demo</a></td> Is that correct? If so, you just need to use the generate-id() function, within {}s for an attribute value template, instead of appID in the above two outputs. In other words, your templates need to look like: <!-- processes the applications' configuration files--> <xsl:template match="*[@configurationPath]" mode="apps"> <xsl:variable name="application" select="@configurationPath"/> <br/> <h2> <a name="{generate-id()}"> Application <xsl:value-of select="$application"/> </a> </h2> <xsl:apply-templates select="document($application)" mode="app"/> </xsl:template> <xsl:template match="base:mainApplication"> <xsl:variable name="test" select="@configurationPath"/> <tr> <td>main application</td> <td> <a href="#{generate-id()}"><xsl:value-of select="@name"/></a> </td> <td><xsl:value-of select="@configurationPath"/></td> </tr> </xsl:template> Cheers, Jeni --- Jeni Tennison http://www.jenitennison.com/ XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|