[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: using a parameter to modify part of the file path

Subject: RE: using a parameter to modify part of the file path in document(...) function
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Mon, 18 Sep 2006 00:10:35 +0100
java file path
Sounds like you are missing the parameter declaration

<xsl:param name="buildingDataFile"/>

Michael Kay
http://www.saxonica.com/
 

> -----Original Message-----
> From: Tracey Zellmann [mailto:tracey.zellmann@xxxxxxxxxxx] 
> Sent: 17 September 2006 19:57
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: Re:  using a parameter to modify part of the 
> file path in document(...) function
> 
> Thanks.
> 
> However, I can not quite get it to work. I must be doing 
> something wrong.
> 
> I have this in my transformer set-up:
> transformer.setParameter("buildingDataFile", 
> this.buildingDataName); where this.buidingDataName is "TownHouseData"
> 
> Then, in my style sheet I have, as you suggested, 
> <xsl:variable name="list" select="document(concat('../', 
> $buildingDataFile, '/inputXML/storyPages.xml'))"/>
> 
> However, I get this error message, stating that the variable, 
> $buildingDataFile has not been declared.
> 
> Error at xsl:variable on line 15 of
> file:///C:/Documents%20and%20Settings/Tracey/workspace/Library
> Project/xslt/stories.xsl:
> XPST0008: XPath syntax error at char 40 on line 15 in {...le,
> '/inputXML/storyPages.x...}:
> Variable $buildingDataFile has not been declared
> 
> In other cases, I have been able to make use of transformer 
> parameters into the html part of  astylesheet with something 
> like this:
> <li><a href="../index.html" title="{$buildingTitle}"> , where 
> buildingTitle was a transformer parameter, but, as I said 
> before, whenever I try to get a parameter into a quoted 
> function, I get into trouble.
> 
> What am I missing?
> 
> There is a more going on in the stylesheet, but nothing 
> really before this line, so I haven't included it.
> 
> ----- Original Message -----
> From: "Michael Kay" <mike@xxxxxxxxxxxx>
> To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
> Sent: Sunday, September 17, 2006 3:23 AM
> Subject: RE:  using a parameter to modify part of the 
> file path in
> document(...) function
> 
> 
> > Change your call on document() to
> >
> > document(concat('../', $buildingDataFile,
> > '/inputXML/buildingStories.xml'))
> >
> > Michael Kay
> > http://www.saxonica.com/
> >
> >> -----Original Message-----
> >> From: Tracey Zellmann [mailto:tracey.zellmann@xxxxxxxxxxx]
> >> Sent: 16 September 2006 20:09
> >> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> >> Subject: Re:  using a parameter to modify part of the 
> file path 
> >> in document(...) function
> >>
> >> I am using XSLT 2.0 and JAVA 1.5.0_07 and the Saxon B 
> >> net.sf.saxon.TransformerFactoryImpl Transformer.
> >>
> >> In my style sheet, I currently import an xml document 
> <xsl:variable 
> >> name="list"
> >> select="document('../inputXml/storyPages.xml')"/>
> >>
> >> Now that everything works, I want to change my input file 
> >> arrangements and use different documents, each named 
> storyPages.xml, 
> >> but from different directories.
> >>
> >> examples:
> >>
> >> ../TownHouseData/inputXML/buildingStories.xml
> >> ../MiddlesexHotelData/inputXML/buildingStories.xml
> >> ../DamonMillData/inputXML/buildingStories.xml
> >>
> >> and so forth.
> >>
> >> I can set a parameter in my java program, 
> >> transformer.setParameter("buildingDataFile", "TownHouseData");
> >>
> >> and use a different setting for the other buildings.
> >>
> >> My problem is that I always get confused in XSLT using 
> variables and 
> >> parameters inside double and single quoted strings.
> >>
> >> What is a clean syntax for accomplishing this?

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.