Iceburg71 Posted December 25, 2022 Share Posted December 25, 2022 tried a few different ways, still can't get this to work. Borrowed code form another of my mods that does work, but this one doesn't.... I am perplexed. I just want to add these 3 items to the RepairKit <insertAfter xpath="/recipes/recipe[@name='resourceRepairKit' and @count='1']"> <ingredient name="resourceOil" count="1"/> <ingredient name="resourceMechanicalParts" count="1"/> <ingredient name="resourceElectricParts" count="1"/> </insertAfter> Link to comment Share on other sites More sharing options...
BFT2020 Posted December 25, 2022 Share Posted December 25, 2022 In your pathing, you need another line: insertAfter xpath="/recipes/recipe[@name='resourceRepairKit' and @count=‘1’]/ingredient[@name=‘forgedIron’]”> verify the ingredient name though as I am guessing Link to comment Share on other sites More sharing options...
khzmusik Posted December 25, 2022 Share Posted December 25, 2022 You can also use "append" instead of "insertAfter". The "insertAfter" command inserts the text after each selected node (as siblings), while the "append" command appends the text as the last child of each selected node. <append xpath="//recipe[@name='resourceRepairKit']"> <ingredient name="resourceOil" count="1"/> <ingredient name="resourceMechanicalParts" count="1"/> <ingredient name="resourceElectricParts" count="1"/> </append> I also took out the "count" attribute, because there is only one recipe named "resourceRepairKit", so it was unnecessary. Link to comment Share on other sites More sharing options...
Iceburg71 Posted December 25, 2022 Author Share Posted December 25, 2022 4 hours ago, BFT2020 said: In your pathing, you need another line: insertAfter xpath="/recipes/recipe[@name='resourceRepairKit' and @count=‘1’]/ingredient[@name=‘forgedIron’]”> verify the ingredient name though as I am guessing I can try that. Didn't have to in my other mod, though. 3 hours ago, khzmusik said: You can also use "append" instead of "insertAfter". The "insertAfter" command inserts the text after each selected node (as siblings), while the "append" command appends the text as the last child of each selected node. <append xpath="//recipe[@name='resourceRepairKit']"> <ingredient name="resourceOil" count="1"/> <ingredient name="resourceMechanicalParts" count="1"/> <ingredient name="resourceElectricParts" count="1"/> </append> I also took out the "count" attribute, because there is only one recipe named "resourceRepairKit", so it was unnecessary. Thanks. Tried append. With syntax very close to that. Didn't work. Having the count=1 on the same line is messing with it I think. But, I had xpath="/recipes/recipe[@name='resourceRepairKit']"> Will try it with your syntax, though, when I get home. Link to comment Share on other sites More sharing options...
khzmusik Posted December 26, 2022 Share Posted December 26, 2022 (edited) On 12/25/2022 at 6:02 PM, Iceburg71 said: I can try that. Didn't have to in my other mod, though. Thanks. Tried append. With syntax very close to that. Didn't work. Having the count=1 on the same line is messing with it I think. But, I had xpath="/recipes/recipe[@name='resourceRepairKit']"> Will try it with your syntax, though, when I get home. I expect you probably know this, but if you open up the console (F1 then "dm"), you can type in "exportcurrentconfigs" and it will print out the XML after all mods/modlets have been applied. You can search for your changes and make sure they applied. I bring this up because you said having "count=1" messed with it. I checked and it shouldn't, so maybe check the exported configs to see what happened. It's usually easy to see XML mistakes, so hopefully that will be helpful. EDIT: The "//" means "a child of any depth, not just the first child." When there is no node preceding it, it means "a child of any depth of the root node" - or in other words, "any XML node in the document." It will choose any "recipe" XML node with a "name" attribute of "resourceRepairKit", but since there is only one such node in the document, it should choose exactly the same node that you were targeting. But it will still work if it's explicit, so "/recipes/recipe[@name='resourceRepairKit']" should work fine. It just has more characters. EDIT 2: Removed some stuff that sounded patronizing when I re-read it. Sorry, didn't mean to be. Edited December 27, 2022 by khzmusik (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now