I don't use VS so can not say for sure, but depending on your templates setup you might be able to fake something by declaring a local variable in the template using it and assigning it the value of the global variable:
Shoot! I spoke too soon! The children now have no more squiggles, but they fail to load unless I remove the variables because they have the same name as an existing variable. So I guess the only solution is to do something like:
<xsl:variable name="var" select="$localVar" />
Probably worth it though, to catch errors that I would've otherwise missed.
How to make include recognize it's parent's variables
So I have three XSLT files mother.xslt and child1.xslt and child2.xslt.
The mother.xslt has an xsl;variable that needs to be in place for both child1 and child2 to function correctly.
However, Visual Studio does not know that the children are imported by the mother. So I see red squiggles every time that I use the mother's variable.
Is there a way to tell VS to look at the mother for the variables?
Hi Sebastiaan,
I don't use VS so can not say for sure, but depending on your templates setup you might be able to fake something by declaring a local variable in the template using it and assigning it the value of the global variable:
<?xml version="1.0" encoding="utf-8" ?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > <xsl:variable name="var" select="'Hello World'" /> <xsl:include href="include1.xslt" /> <xsl:template match="/"> <xsl:value-of select="$var" /> <xsl:call-template name="sub1" /> </xsl:template> </xsl:stylesheet> <!-- In include1.xslt: --> <xsl:template name="sub1"> <xsl:variable name="var" select="$var" /> [<xsl:value-of select="$var" />] </xsl:template>/Chriztian
You sir, are absolutely correct! Thank you, I hate red squiggles!
Shoot! I spoke too soon! The children now have no more squiggles, but they fail to load unless I remove the variables because they have the same name as an existing variable. So I guess the only solution is to do something like:
Probably worth it though, to catch errors that I would've otherwise missed.
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.